You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ga...@apache.org on 2017/04/25 12:38:38 UTC
[couchdb-docker] 26/39: Added environment-based admin user/pass
(#81)
This is an automated email from the ASF dual-hosted git repository.
garren pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/couchdb-docker.git
commit 1666c2ecfbdd3ebac9bbb3857a63495c3ca4cc36
Author: briansneddon <ch...@yahoo.com>
AuthorDate: Sat Oct 8 10:25:18 2016 -0500
Added environment-based admin user/pass (#81)
Added COUCHDB_USER and COUCHDB_PASS from the 1.6.1 version and adjusted the
file locations to reflect the new 2.0.0 locations
---
2.0.0/docker-entrypoint.sh | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/2.0.0/docker-entrypoint.sh b/2.0.0/docker-entrypoint.sh
index d36ed8c..62b14fa 100755
--- a/2.0.0/docker-entrypoint.sh
+++ b/2.0.0/docker-entrypoint.sh
@@ -22,6 +22,30 @@ if [ "$1" = '/opt/couchdb/bin/couchdb' ]; then
chmod 664 /opt/couchdb/etc/*.ini
chmod 775 /opt/couchdb/etc/*.d
+ if [ "$COUCHDB_USER" ] && [ "$COUCHDB_PASSWORD" ]; then
+ # Create admin
+ printf "[admins]\n%s = %s\n" "$COUCHDB_USER" "$COUCHDB_PASSWORD" > /opt/couchdb/etc/local.d/docker.ini
+ chown couchdb:couchdb /opt/couchdb/etc/local.d/docker.ini
+ fi
+
+ # if we don't find an [admins] section followed by a non-comment, display a warning
+ if ! grep -Pzoqr '\[admins\]\n[^;]\w+' /opt/couchdb/etc/local.d/docker.ini; then
+ # The - option suppresses leading tabs but *not* spaces. :)
+ cat >&2 <<-'EOWARN'
+ ****************************************************
+ WARNING: CouchDB is running in Admin Party mode.
+ This will allow anyone with access to the
+ CouchDB port to access your database. In
+ Docker's default configuration, this is
+ effectively any other container on the same
+ system.
+ Use "-e COUCHDB_USER=admin -e COUCHDB_PASSWORD=password"
+ to set it in "docker run".
+ ****************************************************
+ EOWARN
+ fi
+
+
exec gosu couchdb "$@"
fi
--
To stop receiving notification emails like this one, please contact
"commits@couchdb.apache.org" <co...@couchdb.apache.org>.