aboutsummaryrefslogtreecommitdiffstats
path: root/ddns/cfg_parser.py
diff options
context:
space:
mode:
authorMarius Halden <marius.h@lden.org>2014-03-17 04:16:49 +0100
committerMarius Halden <marius.h@lden.org>2014-03-17 04:16:49 +0100
commit7c575aaa8e98a6aa7eda8d69e2b14d014ee91b09 (patch)
tree7bd082fd216e1577440cf1ea599467993c2fef36 /ddns/cfg_parser.py
downloadDDNS.py-7c575aaa8e98a6aa7eda8d69e2b14d014ee91b09.tar.gz
DDNS.py-7c575aaa8e98a6aa7eda8d69e2b14d014ee91b09.tar.bz2
DDNS.py-7c575aaa8e98a6aa7eda8d69e2b14d014ee91b09.tar.xz
Initial commit
Diffstat (limited to 'ddns/cfg_parser.py')
-rw-r--r--ddns/cfg_parser.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/ddns/cfg_parser.py b/ddns/cfg_parser.py
new file mode 100644
index 0000000..e8134cd
--- /dev/null
+++ b/ddns/cfg_parser.py
@@ -0,0 +1,17 @@
+import yaml
+import io
+import os
+
+cfg_file = None
+cfg = None
+
+def read_config():
+ global cfg
+
+ if not cfg_file or not os.path.exists(cfg_file):
+ return None
+
+ with io.open(cfg_file, 'r') as fp:
+ _cfg = yaml.load(fp)
+
+ cfg = _cfg