]> git.decadent.org.uk Git - dak.git/blobdiff - daklib/utils.py
check for a DAK_CONFIG env variable when looking for dak.conf
[dak.git] / daklib / utils.py
index d88dbbda961e88a4948f5fbe34bed80b3304e8b7..d581e70bd03d6f1719ef7f3cf50fd5af71523357 100755 (executable)
@@ -710,20 +710,24 @@ def where_am_i ():
         return res[0]
 
 def which_conf_file ():
-    res = socket.gethostbyaddr(socket.gethostname())
-    # In case we allow local config files per user, try if one exists
-    if Cnf.FindB("Config::" + res[0] + "::AllowLocalConfig"):
-        homedir = os.getenv("HOME")
-        confpath = os.path.join(homedir, "/etc/dak.conf")
-        if os.path.exists(confpath):
-            apt_pkg.ReadConfigFileISC(Cnf,default_config)
-
-    # We are still in here, so there is no local config file or we do
-    # not allow local files. Do the normal stuff.
-    if Cnf.get("Config::" + res[0] + "::DakConfig"):
-        return Cnf["Config::" + res[0] + "::DakConfig"]
+    if os.getenv("DAK_CONFIG"):
+        print(os.getenv("DAK_CONFIG"))
+        return os.getenv("DAK_CONFIG")
     else:
-        return default_config
+        res = socket.gethostbyaddr(socket.gethostname())
+        # In case we allow local config files per user, try if one exists
+        if Cnf.FindB("Config::" + res[0] + "::AllowLocalConfig"):
+            homedir = os.getenv("HOME")
+            confpath = os.path.join(homedir, "/etc/dak.conf")
+            if os.path.exists(confpath):
+                apt_pkg.ReadConfigFileISC(Cnf,default_config)
+
+        # We are still in here, so there is no local config file or we do
+        # not allow local files. Do the normal stuff.
+        if Cnf.get("Config::" + res[0] + "::DakConfig"):
+            return Cnf["Config::" + res[0] + "::DakConfig"]
+        else:
+            return default_config
 
 def which_apt_conf_file ():
     res = socket.gethostbyaddr(socket.gethostname())