wohali closed pull request #79: Fix configuration save
URL: https://github.com/apache/couchdb-docker/pull/79
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/1.7.1/docker-entrypoint.sh b/1.7.1/docker-entrypoint.sh
index c1c9f56..db5a60e 100755
--- a/1.7.1/docker-entrypoint.sh
+++ b/1.7.1/docker-entrypoint.sh
@@ -36,7 +36,31 @@ if [ "$1" = 'couchdb' ]; then
                chown couchdb:couchdb /usr/local/etc/couchdb/local.d/docker.ini
        fi
 
-       printf "[httpd]\nport = %s\nbind_address = %s\n" 
${COUCHDB_HTTP_PORT:=5984} ${COUCHDB_HTTP_BIND_ADDRESS:=0.0.0.0} > 
/usr/local/etc/couchdb/local.d/bind_address.ini
+       if [ -f /usr/local/etc/couchdb/local.d/bind_address.ini ]; then
+               if ! grep -Fq "port =" 
/usr/local/etc/couchdb/local.d/bind_address.ini; then
+                       vport=$(printf "[httpd]\\\nport = %s" 
${COUCHDB_HTTP_PORT:=5984})
+                       if grep -qF '[httpd]' 
/usr/local/etc/couchdb/local.d/bind_address.ini; then
+                               sed -i -e "s/\\[httpd\\]/$vport/g" 
/usr/local/etc/couchdb/local.d/bind_address.ini
+                       else
+                               printf "$vport" >> 
/usr/local/etc/couchdb/local.d/bind_address.ini
+                       fi
+
+               fi
+
+               if ! grep -Fq "bind_address =" 
/usr/local/etc/couchdb/local.d/bind_address.ini; then
+                       vaddress=$(printf "[httpd]\\\nbind_address = %s" 
${COUCHDB_HTTP_BIND_ADDRESS:=0.0.0.0})
+                       if grep -qF '[httpd]' 
/usr/local/etc/couchdb/local.d/bind_address.ini; then
+                               sed -i -e "s/\\[httpd\\]/$vaddress/g" 
/usr/local/etc/couchdb/local.d/bind_address.ini
+                       else
+                               printf "$vaddress" >> 
/usr/local/etc/couchdb/local.d/bind_address.ini
+                       fi
+
+               fi
+
+       else
+               printf "[httpd]\nport = %s\nbind_address = %s\n" 
${COUCHDB_HTTP_PORT:=5984} ${COUCHDB_HTTP_BIND_ADDRESS:=0.0.0.0} > 
/usr/local/etc/couchdb/local.d/bind_address.ini
+       fi
+
        chown couchdb:couchdb /usr/local/etc/couchdb/local.d/bind_address.ini
 
        # if we don't find an [admins] section followed by a non-comment, 
display a warning


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to