Changeset - eabd5a2fd0af
[Not reviewed]
default
0 2 0
Mads Kiilerich - 6 years ago 2020-03-30 16:10:54
mads@kiilerich.com
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 ...
2 files changed with 3 insertions and 4 deletions:
0 comments (0 inline, 0 general)
kallithea/config/app_cfg.py
Show inline comments
 
@@ -40,8 +40,8 @@ from kallithea.lib.middleware.permanent_
 
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 @@ def setup_configuration(app):
 

	
 
    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', '*')
kallithea/lib/utils.py
Show inline comments
 
@@ -365,6 +365,7 @@ def set_app_settings(config):
 
    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):
0 comments (0 inline, 0 general)