-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathconfigs.py
80 lines (68 loc) · 2.27 KB
/
configs.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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
import os
import dotenv
import json
dotenv.load_dotenv()
org_settings_path = os.environ.get("ORG_SETTINGS", "settings.json")
try:
with open(org_settings_path) as f:
data = json.load(f)
except FileNotFoundError:
with open(org_settings_path, "w") as f:
data = {
"1": {
"general_meetings_requirement": 16,
"committee_meetings_requirement": 6,
"social_meetings_requirement": 1,
"volunteering_meetings_requirement": 1
},
"2": {
"attendance": [
{"percent": 100, "points": 3},
{"percent": 75, "points": 2},
{"percent": 50, "points": 1}
],
"volunteer": [
{"threshold": 9, "points": 4},
{"threshold": 6, "points": 3},
{"threshold": 3, "points": 2},
{"threshold": 1, "points": 1},
],
"mentorship_minimum": 3,
"mentorship_maximum": 9,
"required_points": 18
}
}
json.dump(data, f)
def update_org_settings(org: int, **kwargs):
data.update({str(org): dict(**kwargs)})
with open(org_settings_path, "w") as f:
json.dump(data, f)
class Config:
SECRET_KEY = os.environ["SECRET_KEY"]
ORG_SETTINGS = data
class DevelopmentConfig(Config):
DEBUG = True
SERVER_NAME = "localhost:8080"
SQLALCHEMY_DATABASE_URI = "sqlite:///dev.db"
DEFACTO_ADMIN = {
"rit_id": "wls1234",
"first_name": "Will",
"last_name": "Smith",
"email": "[email protected]"
}
class LocalConfig(Config):
TESTING = True
DEBUG = True
SERVER_NAME = "ec2-54-196-105-29.compute-1.amazonaws.com:8080"
SQLALCHEMY_DATABASE_URI = "sqlite:///dev.db"
class ProductionConfig(Config):
USE_X_SENDFILE = True
SERVER_NAME = "consortia.gccis.rit.edu"
SQLALCHEMY_DATABASE_URI = "sqlite:///dev.db"
#SQLALCHEMY_DATABASE_URI = f"mariadb+mariadbconnector://consortia:{os.environ['DB_PASSWORD']}@localhost:3306/consortia"
DEFACTO_ADMIN = {
"rit_id": "njz8626",
"first_name": "Nathan",
"last_name": "Zilora",
"email": "[email protected]"
}