Created
January 23, 2021 10:59
-
-
Save unlocomqx/9d7a8510ab857d660edb309eff2b9e1a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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