-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.py
More file actions
49 lines (42 loc) · 1.17 KB
/
Copy pathconfig.py
File metadata and controls
49 lines (42 loc) · 1.17 KB
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
# 导入不同功能的配置文件
try:
from policy_config import POLICY_CONFIGS
except ImportError:
POLICY_CONFIGS = {}
try:
from chaos_config import CHAOS_CONFIGS
except ImportError:
CHAOS_CONFIGS = {}
try:
from challenge_config import CHALLENGE_CONFIGS
except ImportError:
CHALLENGE_CONFIGS = {}
# API服务配置
API_CONFIG = {
"tokens": [
"test_api_token_1_KQo55s0",
"test_api_token_2_EazcmGeU9",
"test_api_token_3_m63Cdvc"
],
"host": "0.0.0.0",
"port": 8000,
"log_file": "logs/waf_api.log" # 使用相对路径,兼容Linux和Windows
}
# 配置选择函数
def get_config_by_type(config_type):
"""根据配置类型返回相应的配置"""
if config_type == "policy":
return POLICY_CONFIGS
elif config_type == "chaos":
return CHAOS_CONFIGS
elif config_type == "challenge":
return CHALLENGE_CONFIGS
else:
# 默认返回空配置
return {}
# 当前使用的配置(兼容旧代码)
WAF_CONFIGS = {}
# 混沌工程配置(兼容旧代码)
WAF_CHAOS_CONFIGS = CHAOS_CONFIGS
# Challenge配置(兼容旧代码)
WAF_CHALLENGE_CONFIGS = CHALLENGE_CONFIGS