changeset 8330:eabd5a2fd0af

config: set base_path config in set_app_settings using Ui.get_repos_location() instead of in app_cfg using make_ui() Only hit the database once (when starting the application) to get this. It would perhaps be more elegant to set it directly, for example in kallithea.base_path ... but it seems like a setting that really belongs in the .ini file ...
author Mads Kiilerich <mads@kiilerich.com>
date Mon, 30 Mar 2020 16:10:54 +0200
parents 6484a0fc0e0b
children d5c7930e3d5a
files kallithea/config/app_cfg.py kallithea/lib/utils.py
diffstat 2 files changed, 3 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/config/app_cfg.py	Mon Mar 30 13:17:18 2020 +0200
+++ b/kallithea/config/app_cfg.py	Mon Mar 30 16:10:54 2020 +0200
@@ -40,8 +40,8 @@
 from kallithea.lib.middleware.simplegit import SimpleGit
 from kallithea.lib.middleware.simplehg import SimpleHg
 from kallithea.lib.middleware.wrapper import RequestWrapper
-from kallithea.lib.utils import check_git_version, load_rcextensions, make_ui, set_app_settings, set_indexer_config, set_vcs_config
-from kallithea.lib.utils2 import safe_str, str2bool
+from kallithea.lib.utils import check_git_version, load_rcextensions, set_app_settings, set_indexer_config, set_vcs_config
+from kallithea.lib.utils2 import str2bool
 
 
 log = logging.getLogger(__name__)
@@ -165,8 +165,6 @@
 
     load_rcextensions(root_path=config['here'])
 
-    repos_path = safe_str(make_ui().configitems(b'paths')[0][1])
-    config['base_path'] = repos_path
     set_app_settings(config)
 
     instance_id = kallithea.CONFIG.get('instance_id', '*')
--- a/kallithea/lib/utils.py	Mon Mar 30 13:17:18 2020 +0200
+++ b/kallithea/lib/utils.py	Mon Mar 30 16:10:54 2020 +0200
@@ -365,6 +365,7 @@
     hgsettings = Setting.get_app_settings()
     for k, v in hgsettings.items():
         config[k] = v
+    config['base_path'] = Ui.get_repos_location()
 
 
 def set_vcs_config(config):