forked from stitionai/devika
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.py
89 lines (64 loc) · 2.48 KB
/
config.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
81
82
83
84
85
86
87
88
89
import toml
class Config:
def __init__(self):
self.config = toml.load("config.toml")
def get_config(self):
return self.config
def get_bing_api_key(self):
return self.config["API_KEYS"]["BING"]
def get_bing_api_endpoint(self):
return self.config["API_ENDPOINTS"]["BING"]
def get_claude_api_key(self):
return self.config["API_KEYS"]["CLAUDE"]
def get_openai_api_key(self):
return self.config["API_KEYS"]["OPENAI"]
def get_netlify_api_key(self):
return self.config["API_KEYS"]["NETLIFY"]
def get_sqlite_db(self):
return self.config["STORAGE"]["SQLITE_DB"]
def get_screenshots_dir(self):
return self.config["STORAGE"]["SCREENSHOTS_DIR"]
def get_pdfs_dir(self):
return self.config["STORAGE"]["PDFS_DIR"]
def get_projects_dir(self):
return self.config["STORAGE"]["PROJECTS_DIR"]
def get_logs_dir(self):
return self.config["STORAGE"]["LOGS_DIR"]
def get_repos_dir(self):
return self.config["STORAGE"]["REPOS_DIR"]
def set_bing_api_key(self, key):
self.config["API_KEYS"]["BING"] = key
self.save_config()
def set_bing_api_endpoint(self, endpoint):
self.config["API_ENDPOINTS"]["BING"] = endpoint
self.save_config()
def set_claude_api_key(self, key):
self.config["API_KEYS"]["CLAUDE"] = key
self.save_config()
def set_openai_api_key(self, key):
self.config["API_KEYS"]["OPENAI"] = key
self.save_config()
def set_netlify_api_key(self, key):
self.config["API_KEYS"]["NETLIFY"] = key
self.save_config()
def set_sqlite_db(self, db):
self.config["STORAGE"]["SQLITE_DB"] = db
self.save_config()
def set_screenshots_dir(self, dir):
self.config["STORAGE"]["SCREENSHOTS_DIR"] = dir
self.save_config()
def set_pdfs_dir(self, dir):
self.config["STORAGE"]["PDFS_DIR"] = dir
self.save_config()
def set_projects_dir(self, dir):
self.config["STORAGE"]["PROJECTS_DIR"] = dir
self.save_config()
def set_logs_dir(self, dir):
self.config["STORAGE"]["LOGS_DIR"] = dir
self.save_config()
def set_repos_dir(self, dir):
self.config["STORAGE"]["REPOS_DIR"] = dir
self.save_config()
def save_config(self):
with open("config.toml", "w") as f:
toml.dump(self.config, f)