Mercurial > libervia-backend
changeset 2965:121c4a2a567c
core (config): if flatpak is detected, config is also looked after in /app
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 23 Jun 2019 17:40:19 +0200 |
parents | 17c61d09a85b |
children | 43e5e0dc8c60 |
files | sat/core/constants.py sat/tools/config.py |
diffstat | 2 files changed, 15 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/sat/core/constants.py Fri Jun 21 12:59:36 2019 +0200 +++ b/sat/core/constants.py Sun Jun 23 17:40:19 2019 +0200 @@ -209,6 +209,19 @@ + ".conf" ] else: + import os + CONFIG_PATHS = ( + ["/etc/", "~/", "~/.", "", "."] + + [ + "%s/" % path + for path in list(BaseDirectory.load_config_paths(APP_NAME_FILE)) + ] + ) + + if os.getenv('FLATPAK_ID'): + # for Flatpak, the conf can't be set in /etc or $HOME, so we have + # to add /app + CONFIG_PATHS.append('/app') ## Configuration ## DEFAULT_CONFIG = { @@ -222,11 +235,7 @@ # List of the configuration filenames sorted by ascending priority CONFIG_FILES = [ realpath(expanduser(path) + APP_NAME_FILE + ".conf") - for path in ["/etc/", "~/", "~/.", "", "."] - + [ - "%s/" % path - for path in list(BaseDirectory.load_config_paths(APP_NAME_FILE)) - ] + for path in CONFIG_PATHS ] ## Templates ##
--- a/sat/tools/config.py Fri Jun 21 12:59:36 2019 +0200 +++ b/sat/tools/config.py Sun Jun 23 17:40:19 2019 +0200 @@ -32,6 +32,7 @@ log = getLogger(__name__) + def fixConfigOption(section, option, value, silent=True): """Force a configuration option value, writing it in the first found user config file, eventually creating a new user config file if none is found.