Changeset - 7292c5976752
[Not reviewed]
default
0 4 0
Mads Kiilerich - 8 years ago 2017-09-14 02:08:06
mads@kiilerich.com
ini: simplify preservation of old settings - just keep the old line as comment

The thing about skipping mako function references is not important.
4 files changed with 7 insertions and 4 deletions:
0 comments (0 inline, 0 general)
development.ini
Show inline comments
 
@@ -109,12 +109,13 @@ index_dir = %(here)s/data/index
 
initial_repo_scan = true
 

	
 
## uncomment and set this path to use archive download cache
 
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)
 
cut_off_limit = 256000
 

	
 
## force https in Kallithea, fixes https redirects, assumes it's always https
 
@@ -283,12 +284,13 @@ beaker.session.key = kallithea
 
## Sessions should always only be accessible by the browser, not directly by JavaScript.
 
beaker.session.httponly = true
 
## Session lifetime. 2592000 seconds is 30 days.
 
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>
 
#beaker.session.validate_key = <validation_key>
 

	
 
## Type of storage used for the session, current types are
kallithea/lib/inifile.py
Show inline comments
 
@@ -89,15 +89,14 @@ def expand(template, desc, mako_variable
 

	
 
            def process_line(m):
 
                """process a section line and update value if necessary"""
 
                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
 
            lines = re.sub(r'^([^#\n\s]*)[ \t]*=[ \t]*(.*)$', process_line, lines, flags=re.MULTILINE)
 

	
 
        return sectionname + '\n' + lines
kallithea/tests/test.ini
Show inline comments
 
@@ -105,12 +105,13 @@ index_dir = %(here)s/data/index
 
initial_repo_scan = false
 

	
 
## uncomment and set this path to use archive download cache
 
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)
 
cut_off_limit = 256000
 

	
 
## force https in Kallithea, fixes https redirects, assumes it's always https
 
@@ -281,12 +282,13 @@ beaker.session.key = kallithea
 
## Sessions should always only be accessible by the browser, not directly by JavaScript.
 
beaker.session.httponly = true
 
## Session lifetime. 2592000 seconds is 30 days.
 
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>
 
#beaker.session.validate_key = <validation_key>
 

	
 
## Type of storage used for the session, current types are
scripts/generate-ini.py
Show inline comments
 
@@ -14,13 +14,13 @@ makofile = 'kallithea/lib/paster_command
 
# the mako variables used in all other ini files and templates
 
mako_variable_values = {
 
    'database_engine': 'sqlite',
 
    '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
 
ini_files = [
 
    ('kallithea/tests/test.ini',
 
        '''
0 comments (0 inline, 0 general)