aboutsummaryrefslogtreecommitdiffstats
path: root/config.py
diff options
context:
space:
mode:
authornico <nico@magicbroccoli.de>2019-06-10 12:49:32 +0200
committernico <nico@magicbroccoli.de>2019-06-10 12:56:01 +0200
commit243d48b92d82d15115b8d341649b405a11603c14 (patch)
treef131604385c6dd5a065d6c5e0ba1ac5c18554cee /config.py
parentb5176fd5585262f11d1c5bc866b1cbe9d9b9fa9b (diff)
parent0d7e2f0c7cef6b7a853107bf37d44816244e7749 (diff)
Merge branch 'report'0.1.0
Misc + add report directory + add template directory + add config.py loading user config Feature Release + add report feature --report + add basic report template + add feature to use -d/ --domain flag multiple times Optimization * further code optimization * update gitignore file
Diffstat (limited to 'config.py')
-rw-r--r--config.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/config.py b/config.py
new file mode 100644
index 0000000..fac5f9b
--- /dev/null
+++ b/config.py
@@ -0,0 +1,23 @@
+# -*- coding: utf-8 -*-
+import json
+import os
+
+# filepath of the config.json in the project directory
+path = os.path.dirname(__file__)
+filepath = ("/".join([path, "config.json"]))
+
+# try to read config.json if nonexistent create config.json an populate it
+try:
+ with open(filepath, "r", encoding="utf-8") as f:
+ config = json.load(f)
+
+except FileNotFoundError:
+ with open(filepath, "w", encoding="utf-8") as f:
+ config = {
+ "name": "",
+ }
+ f.write(json.dumps(config))
+
+
+class Config(object):
+ name = config["name"]