summaryrefslogtreecommitdiff
path: root/kvmd/application.py
diff options
context:
space:
mode:
Diffstat (limited to 'kvmd/application.py')
-rw-r--r--kvmd/application.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/kvmd/application.py b/kvmd/application.py
new file mode 100644
index 00000000..a78c1047
--- /dev/null
+++ b/kvmd/application.py
@@ -0,0 +1,22 @@
+import argparse
+import logging
+import logging.config
+
+from typing import Dict
+
+import yaml
+
+
+# =====
+def init() -> Dict:
+ parser = argparse.ArgumentParser()
+ parser.add_argument("-c", "--config", required=True, metavar="<path>")
+ options = parser.parse_args()
+
+ with open(options.config) as config_file:
+ config = yaml.load(config_file)
+
+ logging.captureWarnings(True)
+ logging.config.dictConfig(config["logging"])
+
+ return config["kvmd"]