refatoracao
This commit is contained in:
56
config.py
56
config.py
@@ -1,28 +1,28 @@
|
||||
import json
|
||||
import os
|
||||
|
||||
CONFIG_FILE = "/app/data/config.json"
|
||||
|
||||
def get_config():
|
||||
if not os.path.exists("/app/data"):
|
||||
os.makedirs("/app/data", exist_ok=True)
|
||||
|
||||
if os.path.exists(CONFIG_FILE):
|
||||
try:
|
||||
with open(CONFIG_FILE, "r") as f:
|
||||
return json.load(f)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# Configuração Padrão
|
||||
return {
|
||||
"active_provider": "gemini",
|
||||
"gemini_api_key": "",
|
||||
"web_password": "@@Gi05Br;;"
|
||||
}
|
||||
|
||||
def save_config(cfg):
|
||||
if not os.path.exists("/app/data"):
|
||||
os.makedirs("/app/data", exist_ok=True)
|
||||
with open(CONFIG_FILE, "w") as f:
|
||||
json.dump(cfg, f, indent=4)
|
||||
import json
|
||||
import os
|
||||
|
||||
CONFIG_FILE = "/app/data/config.json"
|
||||
|
||||
def get_config():
|
||||
if not os.path.exists("/app/data"):
|
||||
os.makedirs("/app/data", exist_ok=True)
|
||||
|
||||
if os.path.exists(CONFIG_FILE):
|
||||
try:
|
||||
with open(CONFIG_FILE, "r") as f:
|
||||
return json.load(f)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# Configuração Padrão
|
||||
return {
|
||||
"active_provider": "gemini",
|
||||
"gemini_api_key": "",
|
||||
"web_password": "@@Gi05Br;;"
|
||||
}
|
||||
|
||||
def save_config(cfg):
|
||||
if not os.path.exists("/app/data"):
|
||||
os.makedirs("/app/data", exist_ok=True)
|
||||
with open(CONFIG_FILE, "w") as f:
|
||||
json.dump(cfg, f, indent=4)
|
||||
|
||||
Reference in New Issue
Block a user