Skip to content

Commit

Permalink
refactor: rename save_config to dump_config
Browse files Browse the repository at this point in the history
  • Loading branch information
fauneau committed Mar 29, 2024
1 parent e3e3a19 commit 0efceb2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion devika.py
Expand Up @@ -211,7 +211,7 @@ def set_settings():
data = request.json
config = Config()
config.config.update(data)
config.save_config()
config.dump_config()
return jsonify({"message": "Settings updated"})


Expand Down
30 changes: 15 additions & 15 deletions src/config.py
Expand Up @@ -70,60 +70,60 @@ def get_logging_prompts(self):

def set_bing_api_key(self, key):
self.config["API_KEYS"]["BING"] = key
self.save_config()
self.dump_config()

def set_bing_api_endpoint(self, endpoint):
self.config["API_ENDPOINTS"]["BING"] = endpoint
self.save_config()
self.dump_config()

def set_ollama_api_endpoint(self, endpoint):
self.config["API_ENDPOINTS"]["OLLAMA"] = endpoint
self.save_config()
self.dump_config()

def set_claude_api_key(self, key):
self.config["API_KEYS"]["CLAUDE"] = key
self.save_config()
self.dump_config()

def set_openai_api_key(self, key):
self.config["API_KEYS"]["OPENAI"] = key
self.save_config()
self.dump_config()

def set_netlify_api_key(self, key):
self.config["API_KEYS"]["NETLIFY"] = key
self.save_config()
self.dump_config()

def set_sqlite_db(self, db):
self.config["STORAGE"]["SQLITE_DB"] = db
self.save_config()
self.dump_config()

def set_screenshots_dir(self, dir):
self.config["STORAGE"]["SCREENSHOTS_DIR"] = dir
self.save_config()
self.dump_config()

def set_pdfs_dir(self, dir):
self.config["STORAGE"]["PDFS_DIR"] = dir
self.save_config()
self.dump_config()

def set_projects_dir(self, dir):
self.config["STORAGE"]["PROJECTS_DIR"] = dir
self.save_config()
self.dump_config()

def set_logs_dir(self, dir):
self.config["STORAGE"]["LOGS_DIR"] = dir
self.save_config()
self.dump_config()

def set_repos_dir(self, dir):
self.config["STORAGE"]["REPOS_DIR"] = dir
self.save_config()
self.dump_config()

def set_logging_rest_api(self, value):
self.config["LOGGING"]["LOG_REST_API"] = "true" if value else "false"
self.save_config()
self.dump_config()

def set_logging_prompts(self, value):
self.config["LOGGING"]["LOG_PROMPTS"] = "true" if value else "false"
self.save_config()
self.dump_config()

def save_config(self):
def dump_config(self):
with open(self._CONFIG_FILE, "w") as f:
toml.dump(self.config, f)

0 comments on commit 0efceb2

Please sign in to comment.