Openverse is a search engine for openly-licensed media. This monorepo includes all application code.
Make Plausible setup idempotent (#943)
Dhruv Bhanushalicf62650ca352
diff --git a/setup_plausible.sh b/setup_plausible.shindex fe7d193d7..8758bad62 100755--- a/setup_plausible.sh+++ b/setup_plausible.sh@@ -16,12 +16,22 @@ docker-compose exec -T "$PLAUSIBLE_DB_SERVICE_NAME" /bin/bash -c "psql -U deploy(id, user_id, name, key_prefix, key_hash, inserted_at, updated_at, scopes, hourly_request_limit)VALUES(1, 1, 'Development', 'aaaaaa', '332015ffc9f0e1f475c0fadb1e1a14d2eb09774249f71961f5a2c477efc0a0fc', now(), now(), '{sites:provision:*}', 1000)+ ON CONFLICT (id) DO NOTHINGEOF"# Create site using API key-curl \+RES=$(curl \-X POST \-H "Authorization: Bearer aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" \-F 'domain="localhost"' \-F 'timezone="UTC"' \- http://localhost:50288/api/v1/sites+ http://localhost:50288/api/v1/sites)++if [[ "$RES" == *"\"error\":\"domain This domain has already been taken"* ]]; then+ echo "Domain already exists."+elif [[ "$RES" == *"\"domain\":\"localhost\""* ]]; then+ echo "Domain created."+else+ echo "Error: $RES"+ exit 1+fi