-
Notifications
You must be signed in to change notification settings - Fork 3
/
secret_settings.py
25 lines (23 loc) · 1.01 KB
/
secret_settings.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
"""
Contains all the secrets for the website. Production uses a different file, that is not pushed to github.
"""
import json
import os
import sys
if sys.platform.startswith("linux"):
if os.path.exists("/etc/secrets.json"): # Linux local dev or staging/production server
with open("/etc/secrets.json", "r") as f:
secrets = json.load(f)
elif os.path.exists("tests/secrets.json"): # CI server
with open("tests/secrets.json", "r") as f:
secrets = json.load(f)
else:
raise FileNotFoundError("secrets.json file not found. Please refer to the Cosmos website wiki.")
elif sys.platform.startswith("win32"):
if os.path.exists(str(os.path.expanduser("~")) + "\\secrets.json"): # Windows local dev
with open(str(os.path.expanduser("~")) + "\\secrets.json", "r") as f:
secrets = json.load(f)
else:
raise FileNotFoundError("secrets.json file not found. Please refer to the Cosmos website wiki.")
else:
raise Exception("Platform not supported")