changeset 6891:7292c5976752

ini: simplify preservation of old settings - just keep the old line as comment The thing about skipping mako function references is not important.
author Mads Kiilerich <mads@kiilerich.com>
date Thu, 14 Sep 2017 02:08:06 +0200
parents 2b6459f9e91a
children f9b5deab451e
files development.ini kallithea/lib/inifile.py kallithea/tests/test.ini scripts/generate-ini.py
diffstat 4 files changed, 8 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/development.ini	Thu Sep 14 02:08:06 2017 +0200
+++ b/development.ini	Thu Sep 14 02:08:06 2017 +0200
@@ -112,6 +112,7 @@
 archive_cache_dir = %(here)s/tarballcache
 
 ## change this to unique ID for security
+#app_instance_uuid = VERY-SECRET
 app_instance_uuid = development-not-secret
 
 ## cut off limit for large diffs (size in bytes)
@@ -286,6 +287,7 @@
 beaker.session.timeout = 2592000
 
 ## Server secret used with HMAC to ensure integrity of cookies.
+#beaker.session.secret = VERY-SECRET
 beaker.session.secret = development-not-secret
 ## Further, encrypt the data with AES.
 #beaker.session.encrypt_key = <key_for_encryption>
--- a/kallithea/lib/inifile.py	Thu Sep 14 02:08:06 2017 +0200
+++ b/kallithea/lib/inifile.py	Thu Sep 14 02:08:06 2017 +0200
@@ -64,7 +64,7 @@
     [first-section]
     <BLANKLINE>
     variable=VALUE
-    #variable2 = value after tab
+    #variable2  =    value after tab
     variable2 = VAL2
     <BLANKLINE>
     <BLANKLINE>
@@ -92,9 +92,8 @@
                 key, value = m.groups()
                 line = m.group(0)
                 if key in section_settings:
-                    line = '%s = %s' % (key, section_settings[key])
-                    if '$' not in value:
-                        line = '#%s = %s\n%s' % (key, value, line)
+                    # keep old entry as example - comments might refer to it
+                    line = '#%s\n%s = %s' % (line, key, section_settings[key])
                 return line.rstrip()
 
             # process lines that not are comments or empty and look like name=value
--- a/kallithea/tests/test.ini	Thu Sep 14 02:08:06 2017 +0200
+++ b/kallithea/tests/test.ini	Thu Sep 14 02:08:06 2017 +0200
@@ -108,6 +108,7 @@
 archive_cache_dir = %(here)s/tarballcache
 
 ## change this to unique ID for security
+#app_instance_uuid = VERY-SECRET
 app_instance_uuid = test
 
 ## cut off limit for large diffs (size in bytes)
@@ -284,6 +285,7 @@
 beaker.session.timeout = 2592000
 
 ## Server secret used with HMAC to ensure integrity of cookies.
+#beaker.session.secret = VERY-SECRET
 beaker.session.secret = {74e0cd75-b339-478b-b129-07dd221def1f}
 ## Further, encrypt the data with AES.
 #beaker.session.encrypt_key = <key_for_encryption>
--- a/scripts/generate-ini.py	Thu Sep 14 02:08:06 2017 +0200
+++ b/scripts/generate-ini.py	Thu Sep 14 02:08:06 2017 +0200
@@ -17,7 +17,7 @@
     'http_server': 'waitress',
     'host': '127.0.0.1',
     'port': '5000',
-    'uuid': lambda: '${app_instance_uuid}',
+    'uuid': lambda: 'VERY-SECRET',
 }
 
 # files to be generated from the mako template