summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--INSTALL6
-rw-r--r--TESTING2
-rw-r--r--aurweb/config.py10
-rw-r--r--conf/config.defaults (renamed from conf/config.proto)0
-rw-r--r--web/lib/confparser.inc.php12
5 files changed, 22 insertions, 8 deletions
diff --git a/INSTALL b/INSTALL
index c72c4a2e..7170aea1 100644
--- a/INSTALL
+++ b/INSTALL
@@ -40,8 +40,10 @@ read the instructions below.
Ensure to enable the pdo_mysql extension in php.ini.
-3) Copy conf/config.proto to /etc/aurweb/config and adjust the configuration
- (pay attention to disable_http_login, enable_maintenance and aur_location).
+3) Optionally copy conf/config.defaults to /etc/aurweb/. Create or copy
+ /etc/aurweb/config (this is expected to contain all configuration settings
+ if the defaults file does not exist) and adjust the configuration (pay
+ attention to disable_http_login, enable_maintenance and aur_location).
4) Create a new MySQL database and a user and import the aurweb SQL schema:
diff --git a/TESTING b/TESTING
index 53ffef24..b0a5f628 100644
--- a/TESTING
+++ b/TESTING
@@ -23,7 +23,7 @@ INSTALL.
$ sqlite3 ../aurweb.sqlite3 < aur-schema-sqlite.sql
$ sqlite3 ../aurweb.sqlite3 < out.sql
-4) Copy conf/config.proto to conf/config and adjust the configuration
+4) Copy conf/config.defaults to conf/config and adjust the configuration
(pay attention to disable_http_login, enable_maintenance and aur_location).
Be sure to change backend to sqlite and name to the file location of your
diff --git a/aurweb/config.py b/aurweb/config.py
index a52d9422..52ec461e 100644
--- a/aurweb/config.py
+++ b/aurweb/config.py
@@ -8,11 +8,13 @@ def _get_parser():
global _parser
if not _parser:
+ path = os.environ.get('AUR_CONFIG', '/etc/aurweb/config')
+ defaults = os.environ.get('AUR_CONFIG_DEFAULTS', path + '.defaults')
+
_parser = configparser.RawConfigParser()
- if 'AUR_CONFIG' in os.environ:
- path = os.environ.get('AUR_CONFIG')
- else:
- path = "/etc/aurweb/config"
+ if os.path.isfile(defaults):
+ with open(defaults) as f:
+ _parser.read_file(f)
_parser.read(path)
return _parser
diff --git a/conf/config.proto b/conf/config.defaults
index be37f430..be37f430 100644
--- a/conf/config.proto
+++ b/conf/config.defaults
diff --git a/web/lib/confparser.inc.php b/web/lib/confparser.inc.php
index 499481df..29f17e83 100644
--- a/web/lib/confparser.inc.php
+++ b/web/lib/confparser.inc.php
@@ -8,11 +8,21 @@ function config_load() {
if (!$path) {
$path = "/etc/aurweb/config";
}
+ $defaults_path = getenv('AUR_CONFIG_DEFAULTS');
+ if (!$defaults_path) {
+ $defaults_path = path . ".defaults";
+ }
+ if (file_exists($defaults_path)) {
+ $default_config = parse_ini_file($defaults_path, true, INI_SCANNER_RAW);
+ } else {
+ $default_config = [];
+ }
if (file_exists($path)) {
- $AUR_CONFIG = parse_ini_file($path, true, INI_SCANNER_RAW);
+ $config = parse_ini_file($path, true, INI_SCANNER_RAW);
} else {
die("aurweb config file not found");
}
+ $AUR_CONFIG = array_replace_recursive($default_config, $config)
}
}