mirror of
https://github.com/xfgryujk/blivechat.git
synced 2025-01-13 13:50:10 +08:00
配置文件不进版本库
This commit is contained in:
parent
8aa80fadd3
commit
2df316b81c
@ -17,5 +17,5 @@ README.md
|
||||
|
||||
# runtime data
|
||||
data/*
|
||||
!data/config.ini
|
||||
!data/config.example.ini
|
||||
log/*
|
||||
|
15
config.py
15
config.py
@ -7,7 +7,10 @@ from typing import *
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
CONFIG_PATH = os.path.join('data', 'config.ini')
|
||||
CONFIG_PATH_LIST = [
|
||||
os.path.join('data', 'config.ini'),
|
||||
os.path.join('data', 'config.example.ini')
|
||||
]
|
||||
|
||||
_config: Optional['AppConfig'] = None
|
||||
|
||||
@ -21,8 +24,16 @@ def init():
|
||||
|
||||
|
||||
def reload():
|
||||
config_path = ''
|
||||
for path in CONFIG_PATH_LIST:
|
||||
if os.path.exists(path):
|
||||
config_path = path
|
||||
break
|
||||
if config_path == '':
|
||||
return False
|
||||
|
||||
config = AppConfig()
|
||||
if not config.load(CONFIG_PATH):
|
||||
if not config.load(config_path):
|
||||
return False
|
||||
global _config
|
||||
_config = config
|
||||
|
@ -1,3 +1,6 @@
|
||||
# 如果要修改配置,可以复制此文件并重命名为“config.ini”再修改
|
||||
# If you want to modify the configuration, copy this file and rename it to "config.ini" and edit
|
||||
|
||||
[app]
|
||||
# 数据库配置,见https://docs.sqlalchemy.org/en/13/core/engines.html#database-urls
|
||||
# See https://docs.sqlalchemy.org/en/13/core/engines.html#database-urls
|
Loading…
Reference in New Issue
Block a user