Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

modify db-init entrypoint to support user and password #1114

Merged
merged 8 commits into from
May 29, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docker/db-init/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ COPY ./docker/db-init/docker-entrypoint.sh /root/docker-entrypoint.sh
COPY ./couchdb-setup.sh /root/couchdb-setup.sh
ADD ./design /root/design

CMD sh ./docker-entrypoint.sh
CMD bash ./docker-entrypoint.sh
Empty file modified docker/db-init/crosscompile_db-init.sh
100644 → 100755
Empty file.
17 changes: 14 additions & 3 deletions docker/db-init/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
#!/bin/sh
#!/bin/bash

if [ -z $COUCHDB_HOST ]; then
echo '$COUCHDB_HOST is not set, defaulting to' 'http:https://couchdb:5984'
export $COUCHDB_HOST='http:https://couchdb:5984'
export COUCHDB_HOST='http:https://couchdb:5984'
fi

export COUCHDB_DOMAIN=$(echo $COUCHDB_HOST | sed -E -e 's_.*:https://([^/@]*@)?([^/:]+).*_\2_')
export COUCHDB_PORT=$(echo $COUCHDB_HOST | sed -e 's,^.*:,:,g' -e 's,.*:\([0-9]*\).*,\1,g' -e 's,[^0-9],,g')

#WAIT_TIME
echo "Waiting for couchdb to start"
WAIT_TIME=0
Expand All @@ -18,4 +21,12 @@ done
add-cors-to-couchdb $COUCHDB_HOST

#MIGRATOR
./couchdb-setup.sh -p 5984 -h couchdb
if [[ -z "${COUCHDB_USER}" ]]; then
./couchdb-setup.sh -p $COUCHDB_PORT -h $COUCHDB_DOMAIN
else
if [[ -z "${COUCHDB_PASS}" ]]; then
echo "The COUCHDB_PASS is not set. Exiting..."
else
./couchdb-setup.sh -p $COUCHDB_PORT -h $COUCHDB_DOMAIN -u $COUCHDB_USER -w $COUCHDB_PASS
fi
fi
2 changes: 1 addition & 1 deletion docker/db-init/rpi-Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ COPY ./docker/db-init/docker-entrypoint.sh /root/docker-entrypoint.sh
COPY ./couchdb-setup.sh /root/couchdb-setup.sh
ADD ./design /root/design

CMD sh ./docker-entrypoint.sh
CMD bash ./docker-entrypoint.sh