Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/usr/bin/env bash
docker pull fauna/faunadb
docker container stop faunadb || true && docker container rm faunadb || true
docker run --name faunadb -d \
--health-cmd="faunadb-admin status" --health-interval=2s \
-p 8443:8443 \
-p 8084:8084 \
fauna/faunadb
./docker/wait-for-healthy.sh faunadb 30
echo n | fauna add-endpoint http://localhost:8443/ --alias localhost --key secret
fauna create-database db_name --endpoint=localhost
OUTPUT=$(fauna create-key db_name --endpoint=localhost)
echo "${OUTPUT}"
[[ "${OUTPUT}" =~ secret\:[[:space:]]([A-Za-z0-9_\-]+) ]]
SECRET="${BASH_REMATCH[1]}"
echo "Secret is ${SECRET}"
curl -u ${SECRET}: http://localhost:8084/import --data-binary "@path/to/schema.graphql"
echo "FAUNADB_SECRET=${SECRET}
GRAPHQL_ENDPOINT=http://localhost:8084/graphql" > ".env.test";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment