feat: base get_sysconfig支持传入具体key值
This commit is contained in:
parent
da0b21eb2d
commit
c1d9e91591
|
@ -319,7 +319,9 @@ LOGGING = {
|
|||
##### 加载客户可自定义配置并提供操作方法 #####
|
||||
SYS_JSON_PATH = os.path.join(BASE_DIR, 'server/conf.json')
|
||||
|
||||
def get_sysconfig(reload=False):
|
||||
def get_sysconfig(key='', reload=False):
|
||||
"""获取系统配置可指定key字符串
|
||||
"""
|
||||
config = cache.get('system_config', None)
|
||||
if config is None or reload:
|
||||
# 读取配置文件
|
||||
|
@ -329,6 +331,10 @@ def get_sysconfig(reload=False):
|
|||
config = json.loads(f.read())
|
||||
cache.set('system_config', config)
|
||||
return config
|
||||
if key:
|
||||
k_l = key.split('.')
|
||||
for k in k_l:
|
||||
config = config[k]
|
||||
return config
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue