48 lines
1.2 KiB
Python
48 lines
1.2 KiB
Python
"""
|
|
Global setting of VN Trader.
|
|
"""
|
|
|
|
from logging import CRITICAL
|
|
from typing import Dict, Any
|
|
|
|
from .utility import load_json
|
|
|
|
SETTINGS: Dict[str, Any] = {
|
|
"font.family": "Arial",
|
|
"font.size": 12,
|
|
|
|
"log.active": True,
|
|
"log.level": CRITICAL,
|
|
"log.console": True,
|
|
"log.file": True,
|
|
|
|
"email.server": "smtp.qq.com",
|
|
"email.port": 465,
|
|
"email.username": "",
|
|
"email.password": "",
|
|
"email.sender": "",
|
|
"email.receiver": "",
|
|
|
|
"rqdata.username": "",
|
|
"rqdata.password": "",
|
|
|
|
"database.driver": "sqlite", # see database.Driver
|
|
"database.database": "database.db", # for sqlite, use this as filepath
|
|
"database.host": "localhost",
|
|
"database.port": 3306,
|
|
"database.user": "root",
|
|
"database.password": "",
|
|
"database.authentication_source": "admin", # for mongodb
|
|
|
|
"huafu.data_source": "" # 华富资产自建数据源
|
|
}
|
|
|
|
# Load global setting from json file.
|
|
SETTING_FILENAME: str = "vt_setting.json"
|
|
SETTINGS.update(load_json(SETTING_FILENAME, auto_save=False))
|
|
|
|
|
|
def get_settings(prefix: str = "") -> Dict[str, Any]:
|
|
prefix_length = len(prefix)
|
|
return {k[prefix_length:]: v for k, v in SETTINGS.items() if k.startswith(prefix)}
|