aboutsummaryrefslogtreecommitdiffstats
path: root/ddns/cfg_parser.py
diff options
context:
space:
mode:
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