diff --git a/trytond/trytond/config.py b/trytond/trytond/config.py index 35d6024e4e4..2a7116228d3 100644 --- a/trytond/trytond/config.py +++ b/trytond/trytond/config.py @@ -49,7 +49,7 @@ def parse_uri(uri): class TrytonConfigParser(configparser.ConfigParser): - def __init__(self): + def __init__(self, overrides=None): super().__init__(interpolation=None) self.add_section('web') self.set('web', 'listen', 'localhost:8000') @@ -111,6 +111,8 @@ def __init__(self): self.set('bus', 'cache_timeout', '5') self.set('bus', 'select_timeout', '5') self.add_section('html') + if overrides: + self.update_etc(configfile=overrides) self.update_environ() self.update_etc() @@ -176,8 +178,14 @@ def getboolean(self, section, option, *args, **kwargs): AttributeError): return default + def apply_overriden_defaults(self): + overrides = self.get('admin', 'config_default_overrides') + if not overrides: + return self + return TrytonConfigParser(overrides=overrides) -config = TrytonConfigParser() + +config = TrytonConfigParser().apply_overriden_defaults() if os.path.basename(getattr(main, '__file__', '')) != 'trytond-stat': status.start(config.get('database', 'path'))