changeset 6659:a4715df40299

make-config: use %(here)s in the generated file instead of hardcoding absolute path Restore what paster make-config did until we introduced gearbox in d2aa8b1625a4. The make-config sub command was re-introduced in 6c8af2d22deb but created files with absolute paths.
author Mads Kiilerich <mads@kiilerich.com>
date Tue, 30 May 2017 02:59:45 +0200
parents 6304efbe37a3
children fbc588a09811
files kallithea/lib/paster_commands/make_config.py kallithea/lib/paster_commands/template.ini.mako scripts/generate-ini.py
diffstat 3 files changed, 8 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/lib/paster_commands/make_config.py	Tue May 30 02:59:45 2017 +0200
+++ b/kallithea/lib/paster_commands/make_config.py	Tue May 30 02:59:45 2017 +0200
@@ -125,7 +125,6 @@
     # use default that cannot be replaced
     tmpl_stored_args.update({
         'uuid': lambda: uuid.uuid4().hex,
-        'here': os.path.dirname(os.path.abspath(args.config_file)),
     })
     try:
         # built in template
--- a/kallithea/lib/paster_commands/template.ini.mako	Tue May 30 02:59:45 2017 +0200
+++ b/kallithea/lib/paster_commands/template.ini.mako	Tue May 30 02:59:45 2017 +0200
@@ -2,6 +2,8 @@
 <%text>################################################################################</%text>
 <%text>################################################################################</%text>
 # Kallithea - config file generated with kallithea-config                      #
+#                                                                              #
+# The %(here)s variable will be replaced with the parent directory of this file#
 <%text>################################################################################</%text>
 <%text>################################################################################</%text>
 
@@ -182,15 +184,15 @@
 <%text>## Available Languages:</%text>
 <%text>## cs de fr hu ja nl_BE pl pt_BR ru sk zh_CN zh_TW</%text>
 lang =
-cache_dir = ${here}/data
-index_dir = ${here}/data/index
+cache_dir = %(here)s/data
+index_dir = %(here)s/data/index
 
 <%text>## perform a full repository scan on each server start, this should be</%text>
 <%text>## set to false after first startup, to allow faster server restarts.</%text>
 initial_repo_scan = false
 
 <%text>## uncomment and set this path to use archive download cache</%text>
-archive_cache_dir = ${here}/tarballcache
+archive_cache_dir = %(here)s/tarballcache
 
 <%text>## change this to unique ID for security</%text>
 app_instance_uuid = ${uuid()}
@@ -337,8 +339,8 @@
 <%text>###         BEAKER CACHE        ####</%text>
 <%text>####################################</%text>
 
-beaker.cache.data_dir = ${here}/data/cache/data
-beaker.cache.lock_dir = ${here}/data/cache/lock
+beaker.cache.data_dir = %(here)s/data/cache/data
+beaker.cache.lock_dir = %(here)s/data/cache/lock
 
 beaker.cache.regions = short_term,long_term,sql_cache_short
 
@@ -494,7 +496,7 @@
 
 %if database_engine == 'sqlite':
 # SQLITE [default]
-sqlalchemy.url = sqlite:///${here}/kallithea.db?timeout=60
+sqlalchemy.url = sqlite:///%(here)s/kallithea.db?timeout=60
 
 %elif database_engine == 'postgres':
 # POSTGRESQL
--- a/scripts/generate-ini.py	Tue May 30 02:59:45 2017 +0200
+++ b/scripts/generate-ini.py	Tue May 30 02:59:45 2017 +0200
@@ -21,7 +21,6 @@
 mako_variable_values = {
     'host': '127.0.0.1',
     'port': '5000',
-    'here': '%(here)s',
     'uuid()': '${app_instance_uuid}',
 }
 
@@ -32,8 +31,6 @@
         Kallithea - config for tests:
         sqlalchemy and kallithea_test.sqlite
         custom logging
-
-        The %(here)s variable will be replaced with the parent directory of this file
         ''',
         {
             '[server:main]': {
@@ -72,8 +69,6 @@
         initial_repo_scan = true
         debug = true
         verbose and colorful logging
-
-        The %(here)s variable will be replaced with the parent directory of this file
         ''',
         {
             '[server:main]': {