This is an automated email from the ASF dual-hosted git repository.

vatamane pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/couchdb-pkg.git


The following commit(s) were added to refs/heads/main by this push:
     new 65a117d  Fix wrong handling of bind_address in debian package If there 
was more than one bind_address in the local.ini, for example for prometheus the 
configure step failed. Now only the bind_address of the [chttpd] block is used. 
The config script also looked into all of the local.d/*.ini files. This didn't 
work because of a wrong if condition. The condition was changed, so that i 
correctly evaluates if config files exist.
65a117d is described below

commit 65a117d345077b0fb86c7a99c65b972d4bff3503
Author: Jonas Plaum <[email protected]>
AuthorDate: Wed Mar 26 10:32:44 2025 +0100

    Fix wrong handling of bind_address in debian package
    If there was more than one bind_address in the local.ini, for example for 
prometheus the configure step failed.
    Now only the bind_address of the [chttpd] block is used.
    The config script also looked into all of the local.d/*.ini files. This 
didn't work because of a wrong if condition.
    The condition was changed, so that i correctly evaluates if config files 
exist.
---
 debian/couchdb.config | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/debian/couchdb.config b/debian/couchdb.config
index e21d9e7..80bcca5 100755
--- a/debian/couchdb.config
+++ b/debian/couchdb.config
@@ -92,17 +92,19 @@ if [ -e /opt/couchdb/etc/vm.args ] ; then
   fi
 fi
 if [ -e /opt/couchdb/etc/local.ini ]; then
-  if grep -q '^bind_address =' /opt/couchdb/etc/local.ini; then
-    bindaddress="$(grep '^bind_address' /opt/couchdb/etc/local.ini | cut -d ' 
' -f 3 | stripwhitespace)"
+  addr=$(sed -n '/^\[chttpd\]/, /^\[/ {/bind_address = / s/.* =//p;}' 
/opt/couchdb/etc/local.ini | stripwhitespace)
+  if [ -n "$addr" ]; then
+    bindaddress=$addr
     db_set couchdb/bindaddress "${bindaddress}"
   fi
 fi
 # might be overridden by a local.d file
-if [ -d /opt/couchdb/etc/local.d -a ls /opt/couchdb/etc/local.d/*.ini 
>/dev/null 2>&1 ]; then
+if [ -d /opt/couchdb/etc/local.d ] && ls /opt/couchdb/etc/local.d/*.ini 
>/dev/null 2>&1; then
   for f in $(ls /opt/couchdb/etc/local.d/*.ini); do
-    if grep -q '^bind_address =' $f; then
-      bindaddress="$(grep '^bind_address' $f | cut -d ' ' -f 3 | 
stripwhitespace)"
-      db_set couchdb/bindaddress "${bindaddress}"
+    addr=$(sed -n '/^\[chttpd\]/, /^\[/ {/bind_address = / s/.* =//p;}' $f | 
stripwhitespace)
+    if [ -n "$addr" ]; then
+      bindaddress=$addr
+      db_set couchdb/bindaddress "${bindaddress}"    
     fi
   done
 fi

Reply via email to