-
Notifications
You must be signed in to change notification settings - Fork 2
/
config.py
89 lines (61 loc) · 1.47 KB
/
config.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!-*- coding:utf-8 -*-
# python3.7
# CreateTime: 2023/7/28 21:16
# FileName:
import os
import yaml
# ---------------------------配置----------------------------------
# 估值查询使用缓存
WorthUseCache = True
# 飞书机器人
FeiShuRobotUrl = ''
# Server酱
ChanKey = ''
# 定时任务的时区
CronZone = 'Asia/Shanghai'
# 基金估值任务
FundWorthCron = [
]
# 股票估值任务
StockWorthCron = [
]
# 基金阈值监控任务
FundMonitorCron = [
]
# 股票阈值监控任务
StockMonitorCron = [
]
# 基金历史监控任务
FundHisMonitorCron = [
]
# 股票历史监控任务
StockHisMonitorCron = [
]
# 阈值监控任务广播
BroadMonitorCron = [
]
# 历史监控任务广播
HisBroadMonitorCron = [
]
# ----------------------------------------------------------------
# ---------------------------覆盖配置----------------------------------
# 从配置文件读取
try:
with open('conf/config.yaml', 'r', encoding='utf-8') as file:
data = yaml.safe_load(file)
for k, v in data.items():
locals()[k] = v
except:
pass
# 从系统环境中重载变量
for var, var_value in locals().copy().items():
# 变量命名要求大写开头
if not var[0].isupper() or callable(var_value):
continue
locals()[var] = os.getenv(var, var_value)
# 本地测试时,可增加local_config.py来覆盖配置
try:
from local_config import *
except:
pass
# ----------------------------------------------------------------