Repository navigation
Expand file tree
/
Copy pathconfig.example.yaml
More file actions
166 lines (154 loc) · 4.59 KB
/
Copy pathconfig.example.yaml
File metadata and controls
166 lines (154 loc) · 4.59 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
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
# LINUX DO Credit Config
# Copy to config.yaml for runtime
# App
app:
app_name: "linux-do-credit"
env: "development" # development, testing, production
addr: ":8000"
node_id: 1 # 分布式节点 ID (0-1023),不同实例必须不同
graceful_shutdown_timeout: 30
session_cookie_name: "linux_do_credit_session_id" # change this in local dev env
session_secret: "<uniq string>" # you can't change this after first time start
session_domain: ".linux.do"
session_age: 86400
session_secure: false
session_http_only: false
api_prefix: "/api"
frontend_url: "http://localhost:3000"
frontend_pay_url: "http://localhost:3000/paying"
# OAuth2/OIDC(优先)
oauth2:
client_id: "<OAUTH2_CLIENT_ID>"
client_secret: "<OAUTH2_CLIENT_SECRET>"
redirect_uri: "<OAUTH2_REDIRECT_URI>"
issuer: "https://connect.linux.do/" # OIDC Issuer URL,用于自动发现端点
authorization_endpoint: "https://connect.linux.do/oauth2/authorize"
token_endpoint: "https://connect.linux.do/oauth2/token"
user_endpoint: "https://connect.linux.do/api/user"
# DB
# 支持两种模式:Standalone(单节点)、Primary-Replica(读写分离)
database:
enabled: true
host: "127.0.0.1"
port: 5432
username: "postgres"
password: ""
database: "linux_do_credit"
max_idle_conn: 16
max_open_conn: 128
conn_max_lifetime: 1800
conn_max_idle_time: 600
log_level: "info" # error, warn, info, debug, silent
ssl_mode: "disable"
time_zone: "Asia/Shanghai"
application_name: "pay-server"
# pgb改为true,默认false
prefer_simple_protocol: false
search_path: "public"
statement_cache_capacity: 256
default_query_exec_mode: "cache_statement"
slow_threshold: 200ms
# replicas:
# - host: "replica1.db.local"
# port: 5432
# - host: "replica2.db.local"
# port: 5432
# clickhouse
clickhouse:
enabled: false
hosts:
- "127.0.0.1:9000"
username: "default"
password: ""
database: "linux_do_credit"
max_idle_conn: 10
max_open_conn: 100
conn_max_lifetime: 3600
dial_timeout: 5
block_buffer_size: 10
# Redis
# 支持三种模式:Standalone(单节点)、Sentinel(高可用)、Cluster(水平扩展)
redis:
enabled: true
addrs:
- "127.0.0.1:6379"
username: ""
password: ""
db: 0 # Cluster 模式忽略此项
cluster_mode: false # true 启用 Cluster 模式
master_name: "" # 非空启用 Sentinel 模式
key_prefix: "credit:"
pool_size: 100
min_idle_conn: 10
dial_timeout: 5
read_timeout: 3
write_timeout: 3
max_retries: 3
pool_timeout: 4
conn_max_idle_time: 300
# Log
log:
level: "info" # debug, info, warn, error, fatal, panic
format: "json" # text, json
output: "stdout" # stdout, file
file_path: "./logs/app.log"
max_size: 100
max_age: 30
max_backups: 10
compress: true
# Scheduler
scheduler:
port: 8002 # scheduler probe port
update_user_gamification_scores_task_cron: "0 2 * * *"
dispute_auto_refund_dispatch_interval_seconds: 3
auto_refund_expired_disputes_task_cron: "0 0 * * *"
sync_orders_to_clickhouse_task_cron: "10 0 * * *"
refund_expired_red_envelopes_task_cron: "0 1 * * *"
cleanup_unused_uploads_task_cron: "0 */2 * * *"
settle_pending_payments_task_cron: "0 * * * *"
# Worker
worker:
port: 8001 # worker probe port
concurrency: 20
strict_priority: false
queues:
- name: webhook
priority: 10
- name: whitelist_only
priority: 5
- name: default
priority: 3
# 积分更新速率限制:rate 次/period 秒
gamification_score_rate_limit:
rate: 1 # 允许的请求次数
period: 3 # 时间周期(秒)
# linuxDo
linuxDo:
api_key: "<LINUX_DO_API_KEY>"
# OpenAPI Risk
openapi_risk:
enabled: false
base_url: "https://audit.example.com"
username: "<OPENAPI_USERNAME>"
password: "<OPENAPI_PASSWORD>"
cache_ttl_seconds: 3600
prompt_risk_levels: []
block_risk_levels: []
# OpenTelemetry
otel:
sampling_rate: 0.1 # 采样率 0.0-1.0
# S3 Compatible Storage
# 支持 AWS S3、MinIO、Cloudflare R2、腾讯 COS 等 S3 兼容存储
s3:
enabled: true
endpoint: "https://<Account ID>.r2.cloudflarestorage.com"
region: "auto"
bucket: "<Bucket Name>"
access_key_id: "<S3_ACCESS_KEY_ID>"
secret_access_key: "<S3_SECRET_ACCESS_KEY>"
path_style: false # MinIO 等自托管服务设为 true
key_prefix: "" # 对象 key 前缀,如 "uploads/",可用于分目录存储
cdn_url: "" # CDN 域名(如 https://cdn.example.com),为空则直接读 S3
local_cache:
enabled: false
cache_dir: "./s3_cache"