Add a AUR_CONFIG environment variable that can be used to specify an
alternative configuration file, similar to the feature introduced in
ecbf32f (git-interface: Add AUR_CONFIG environment variable,
2016-08-03).

Signed-off-by: Lukas Fleischer <[email protected]>
---
 web/lib/confparser.inc.php | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/web/lib/confparser.inc.php b/web/lib/confparser.inc.php
index 789300e..e7128be 100644
--- a/web/lib/confparser.inc.php
+++ b/web/lib/confparser.inc.php
@@ -4,7 +4,11 @@ function config_load() {
        global $AUR_CONFIG;
 
        if (!isset($AUR_CONFIG)) {
-               $AUR_CONFIG = parse_ini_file("/etc/aurweb/config", true, 
INI_SCANNER_RAW);
+               $path = getenv('AUR_CONFIG');
+               if (!$path) {
+                       $path = "/etc/aurweb/config";
+               }
+               $AUR_CONFIG = parse_ini_file($path, true, INI_SCANNER_RAW);
        }
 }
 
-- 
2.11.1

Reply via email to