You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ja...@apache.org on 2023/12/02 22:14:14 UTC

(couchdb) 01/01: Relax restriction on `[admins]` in dev `local.ini`

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

jaydoane pushed a commit to branch relax-local-ini-admins-last
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 1ed92b81c872b52cecea6fad4fb10c5f060d6f45
Author: Jay Doane <ja...@apache.org>
AuthorDate: Sat Dec 2 14:13:56 2023 -0800

    Relax restriction on `[admins]` in dev `local.ini`
    
    Currently, `dev/run` relies on the `[admins]` section be last in
    `local.ini`, or it will fail to start and log this message:
    ```
    [info] 2023-12-02T21:50:40.510174Z node1@127.0.0.1 <0.262.0> --------
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      No Admin Account Found, aborting startup.
      Please configure an admin account in your local.ini file.
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    ```
    
    This relaxes that restriction by inserting the admin user just after
    the `[admin]` section line, rather than at the end of the file.
---
 dev/run | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/dev/run b/dev/run
index c5e0a6ad8..9e11fe7e8 100755
--- a/dev/run
+++ b/dev/run
@@ -708,8 +708,10 @@ def hack_local_ini(ctx, contents):
     else:
         user, pswd = ctx["admin"]
 
-    # this relies on [admin] being the last section at the end of the file
-    contents = contents + "\n%s = %s" % (user, hashify(pswd))
+    contents = contents.replace(
+        "\n[admins]\n",
+        "\n[admins]\n%s = %s\n" % (user, hashify(pswd))
+    )
 
     return contents + "\n\n[chttpd_auth]\nsecret = %s\n" % COMMON_SALT