summaryrefslogtreecommitdiff
path: root/aurweb/config.py
diff options
context:
space:
mode:
authorLukas Fleischer <lfleischer@archlinux.org>2016-10-17 15:34:21 +0200
committerLukas Fleischer <lfleischer@archlinux.org>2016-10-17 15:34:21 +0200
commitfdd932ff8d5e5899cfeae9a8b29011fa2cf9d439 (patch)
tree07afb8664e18e4d4fb479525b16db6edf026b72b /aurweb/config.py
parentb091fb77580d56dbdca6424f9065581945b8e815 (diff)
parentc3f464f50fb35ffb7825b90437bd912051a994ee (diff)
Merge branch 'master' into maintaurweb/maint
Diffstat (limited to 'aurweb/config.py')
-rw-r--r--aurweb/config.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/aurweb/config.py b/aurweb/config.py
new file mode 100644
index 0000000..a52d942
--- /dev/null
+++ b/aurweb/config.py
@@ -0,0 +1,30 @@
+import configparser
+import os
+
+_parser = None
+
+
+def _get_parser():
+ global _parser
+
+ if not _parser:
+ _parser = configparser.RawConfigParser()
+ if 'AUR_CONFIG' in os.environ:
+ path = os.environ.get('AUR_CONFIG')
+ else:
+ path = "/etc/aurweb/config"
+ _parser.read(path)
+
+ return _parser
+
+
+def get(section, option):
+ return _get_parser().get(section, option)
+
+
+def getboolean(section, option):
+ return _get_parser().getboolean(section, option)
+
+
+def getint(section, option):
+ return _get_parser().getint(section, option)