summaryrefslogtreecommitdiff
path: root/mongodb
diff options
context:
space:
mode:
authorGeorgios Andreadis <info@gandreadis.com>2020-06-30 17:26:19 +0200
committerFabian Mastenbroek <mail.fabianm@gmail.com>2020-08-24 19:44:35 +0200
commitcac980546e15882a232ce234cbde3e0cda693352 (patch)
tree50fed18858c6c5cbb11c3ecb690ebbff8bc98525 /mongodb
parent80730074581b8a934fb5b064a54912f620fad978 (diff)
Get Docker setup working
Diffstat (limited to 'mongodb')
-rwxr-xr-xmongodb/configure.sh23
1 files changed, 23 insertions, 0 deletions
diff --git a/mongodb/configure.sh b/mongodb/configure.sh
new file mode 100755
index 00000000..78f28ac8
--- /dev/null
+++ b/mongodb/configure.sh
@@ -0,0 +1,23 @@
+if [ -z "$OPENDC_DB" ]; then
+ echo "OPENDC_DB environment variable not specified"
+ exit 1
+fi
+
+if [ -z "$OPENDC_DB_USERNAME" ]; then
+ echo "OPENDC_DB_USERNAME environment variable not specified"
+ exit 1
+fi
+
+if [ -z "$OPENDC_DB_PASSWORD" ]; then
+ echo "OPENDC_DB_PASSWORD environment variable not specified"
+ exit 1
+fi
+
+MONGO_COMMAND="mongo $OPENDC_DB -u $OPENDC_DB_USERNAME -p $OPENDC_DB_PASSWORD --authenticationDatabase $OPENDC_DB"
+
+until eval $MONGO_COMMAND --eval 'db.getCollectionNames();' ; do
+ echo "MongoDB is unavailable - sleeping"
+ sleep 1
+done
+
+echo "MongoDB available"