initial commit
This commit is contained in:
18
backend/config.py
Normal file
18
backend/config.py
Normal file
@@ -0,0 +1,18 @@
|
||||
import os
|
||||
import yaml
|
||||
|
||||
CONFIG_FILE = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "settings.yaml")
|
||||
|
||||
def load_config():
|
||||
if not os.path.exists(CONFIG_FILE):
|
||||
return {}
|
||||
with open(CONFIG_FILE, 'r', encoding='utf-8') as f:
|
||||
return yaml.safe_load(f)
|
||||
|
||||
def save_config(config_data):
|
||||
with open(CONFIG_FILE, 'w', encoding='utf-8') as f:
|
||||
yaml.dump(config_data, f, allow_unicode=True)
|
||||
|
||||
def get_kis_config():
|
||||
config = load_config()
|
||||
return config.get('kis', {})
|
||||
Reference in New Issue
Block a user