diff --git a/.gitignore b/.gitignore index 6a18ad4..898607e 100644 --- a/.gitignore +++ b/.gitignore @@ -94,3 +94,5 @@ ENV/ # Rope project settings .ropeproject +# Ignore self config +config.json diff --git a/config.json b/config.json deleted file mode 100644 index 70097f8..0000000 --- a/config.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "web": { - "debug": true, - "use_reloader": true, - "threaded": true, - "host": "0.0.0.0", - "port": 80 - }, - "disable-static-cache": true -} \ No newline at end of file diff --git a/default_config.json b/default_config.json new file mode 100644 index 0000000..aa69d5d --- /dev/null +++ b/default_config.json @@ -0,0 +1,15 @@ +{ + "disable-static-cache": true, + "web": { + "debug": true, + "use_reloader": true, + "threaded": true, + "host": "0.0.0.0", + "port": 7001 + }, + "git": { + "auto_pull_and_restart": false, + "webhook_endpoint": "/api/git_commit", + "secret": "iOnlyHavePullAccess" + } +} \ No newline at end of file diff --git a/objects/glob.py b/objects/glob.py index 6dabef1..08a05e6 100644 --- a/objects/glob.py +++ b/objects/glob.py @@ -1,4 +1,6 @@ +import os import json +import shutil # ------------------------------------------------------------------------------ # Global variables that is None by default and gets overwritten in other modules @@ -8,5 +10,9 @@ app = None # main.py -> Flask App # ------------------------------------------------------------------------------ # Global variables that initializes on first load of module +if not os.path.isfile("config.json"): + print("`config.json` were not found! Copying default_config and continuing...") + shutil.copy("default_config.json", "config.json") + with open("config.json", "r") as f: config = json.load(f) \ No newline at end of file