Browse Source

HUE-216. Ability to specify Hue configuration directory via environment variable.

Philip Zeyliger 15 years ago
parent
commit
f687a59b0c
2 changed files with 5 additions and 4 deletions
  1. 2 2
      desktop/core/src/desktop/lib/conf.py
  2. 3 2
      desktop/core/src/desktop/settings.py

+ 2 - 2
desktop/core/src/desktop/lib/conf.py

@@ -535,7 +535,7 @@ def bind_module_config(mod, conf_data):
                        members=members,
                        help=mod.__doc__)
 
-def initialize(modules):
+def initialize(modules, config_dir):
   """
   Set up the GLOBAL_CONFIG variable by loading all configuration
   variables from the given module list.
@@ -544,7 +544,7 @@ def initialize(modules):
   """
   global GLOBAL_CONFIG
   # Import confs
-  conf_data = load_confs()
+  conf_data = load_confs(_configs_from_dir(config_dir))
   sections = {}
   for module in modules:
     section = bind_module_config(module, conf_data)

+ 3 - 2
desktop/core/src/desktop/settings.py

@@ -154,7 +154,8 @@ PYLINTRC = get_desktop_root('.pylintrc')
 # Libraries are loaded and configured before the apps
 appmanager.load_libs()
 _lib_conf_modules = filter(None, [app.conf for app in appmanager.DESKTOP_LIBS])
-conf.initialize(_lib_conf_modules)
+_config_dir = os.getenv("HUE_CONF_DIR", get_desktop_root("conf"))
+conf.initialize(_lib_conf_modules, _config_dir)
 
 appmanager.load_apps()
 for app in appmanager.DESKTOP_APPS:
@@ -165,7 +166,7 @@ logging.debug("Installed Django modules: %s" % ",".join(map(str, appmanager.DESK
 # Load app configuration
 _app_conf_modules = filter(None, [app.conf for app in appmanager.DESKTOP_APPS])
 _app_conf_modules.append(desktop.conf)
-conf.initialize(_app_conf_modules)
+conf.initialize(_app_conf_modules, _config_dir)
 
 # Now that we've loaded the desktop conf, set the django DEBUG mode based on the conf.
 DEBUG = desktop.conf.DJANGO_DEBUG_MODE.get()