-
Notifications
You must be signed in to change notification settings - Fork 61
Expand file tree
/
Copy path.env.example
More file actions
149 lines (124 loc) · 6.39 KB
/
Copy path.env.example
File metadata and controls
149 lines (124 loc) · 6.39 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
# ======================
# 本地开发配置(非 Docker)
# ======================
# PostgreSQL
POSTGRES_HOST=localhost
POSTGRES_PORT=5432
POSTGRES_DB=fojin
POSTGRES_USER=fojin
POSTGRES_PASSWORD=change-me-to-a-strong-password
# Elasticsearch
ES_HOST=http://localhost:9200
# Elasticsearch 认证。ES_PASSWORD 留空=无认证(旧行为)。启用时需在 compose 打开
# xpack.security 并为 elastic 用户设密码(elasticsearch-reset-password -u elastic)。
ES_USER=elastic
ES_PASSWORD=
# Redis
REDIS_HOST=localhost
REDIS_PORT=6379
# Redis 密码。留空=无认证(旧行为)。生产建议设置,避免同网络容器无凭据读写/清空 Redis。
# Generate with: python -c "import secrets; print(secrets.token_urlsafe(24))"
REDIS_PASSWORD=
# 运行环境。未设置时按 production 处理(缺少强密钥即启动失败,secure-by-default)。
# 本地裸跑(不经 docker-compose)开发时设为 development 放松校验。
# FOJIN_ENV=production
# JWT(生产环境请更换密钥)
# Generate with: python -c "import secrets; print(secrets.token_urlsafe(32))"
JWT_SECRET_KEY=change-me-generate-a-random-secret
# Idle budget: away longer than this and the reader signs in again. Sliding
# renewal keeps an active session alive without ever exceeding
# JWT_ABSOLUTE_MAX_DAYS from the original sign-in.
JWT_EXPIRE_MINUTES=43200
JWT_ABSOLUTE_MAX_DAYS=90
# BYOK API key encryption (independent of JWT_SECRET_KEY).
# Generate with: python -c "from cryptography.fernet import Fernet; print(Fernet.generate_key().decode())"
# Required in production. In dev, an ephemeral key is generated per boot
# (stored ciphertexts won't survive a restart — by design).
API_KEY_ENCRYPTION_KEY=
# 端口映射(Docker 宿主机端口)
BACKEND_PORT=8000
FRONTEND_PORT=3000
# frontend 容器绑定的宿主机地址。默认 127.0.0.1(仅本机可达,前面应有反向代理
# /CDN 作为入口)。若要不经反代直接从 LAN/公网访问,设为 0.0.0.0——注意 Docker
# 会绕过 ufw 等防火墙直接放行该端口,请自行确认安全组。
FRONTEND_BIND=127.0.0.1
# LLM (OpenAI-compatible)
LLM_API_KEY=sk-your-llm-api-key
LLM_API_URL=https://api.deepseek.com/v1
# Model selection (uncomment to override the gpt-4o-mini default in config.py)
# deepseek-v4-flash : fast tier, $0.28/1M output (replaces legacy deepseek-chat)
# deepseek-v4-pro : pro tier, $0.87/1M output (75% off made permanent 2026-05-23 — now the standard rate, no rollback)
# LLM_MODEL=deepseek-v4-pro
# Embedding
EMBEDDING_API_KEY=sk-your-embedding-api-key
EMBEDDING_API_URL=https://api.siliconflow.cn/v1
# Reranker(API 交叉编码器重排序,显著提升 RAG 检索质量——建议启用)
# 留空则回退到内置关键词重排序(粗糙)。SiliconFlow 同一账号即托管 embedding 与
# bge-reranker-v2-m3;RERANKER_API_KEY 可省略,自动回退到 EMBEDDING_API_KEY。
RERANKER_API_URL=https://api.siliconflow.cn/v1
# RERANKER_API_KEY=sk-your-reranker-api-key
RERANKER_MODEL=BAAI/bge-reranker-v2-m3
# 典津 API(古籍跨平台检索,可选)
DIANJIN_API_KEY=
DIANJIN_API_URL=https://guji.cckb.cn/api
# 高德地图 Web 服务 key(寺院 POI 抓取 + 逆地理编码,可选)
# 免费申请:https://console.amap.com/dev/key/app
# 仅 backend/scripts/fetch_amap_temples*.py 和 backfill_address_regeo.py 使用
AMAP_KEY=
# 百度搜索资源平台 - 主动推送 token(可选,让百度更快发现新页面)
# 领取:https://ziyuan.baidu.com → 站点管理(需先完成站点验证)→ 普通收录 →
# API 提交,复制页面上"接口调用地址"里的 token 参数值。
# 仅 backend/scripts/baidu_push.py 使用;未设置时该脚本报错退出,不影响应用本身。
BAIDU_PUSH_TOKEN=
# Apify (爬虫)
APIFY_TOKEN=apify_api_your-token-here
# Rate limiting (requests per minute, optional)
# RATE_LIMIT_DEFAULT=200
# RATE_LIMIT_LOGIN=10
# RATE_LIMIT_REGISTER=5
# RATE_LIMIT_SMS_SEND=3
# RATE_LIMIT_SMS_VERIFY=10
# RATE_LIMIT_SEMANTIC=20
# RATE_LIMIT_RESEARCH=10
# RATE_LIMIT_AI_DIFF=10
# 开放数据批量导出 /api/exports/*。默认关闭 —— 端点无鉴权且流式导出整个数据集
# (单次 kg.json 实测 50.7MB / 62s),且不在 STRICT_PATHS 内。关闭时路由完全不注册,
# 返回 404。重新放出前请先给重接口单独配置 STRICT_PATHS 限流,并同步恢复前端
# Layout.tsx 的导航项与 App.tsx 的 /exports 路由。
ENABLE_OPEN_DATA_EXPORTS=false
# Prometheus /metrics(默认开启;挂在应用根路径,nginx 不代理 → 仅内网可达。
# 抓取用可选 overlay:docker compose -f docker-compose.yml -f docker-compose.observability.yml up -d
# 详见 docs/OBSERVABILITY.md。设为 false 则完全不挂载该端点。)
# METRICS_ENABLED=true
# OAuth: GitHub (https://github.com/settings/developers)
GITHUB_CLIENT_ID=
GITHUB_CLIENT_SECRET=
# OAuth: Google (https://console.cloud.google.com/apis/credentials)
GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=
# SMS / phone login. OFF by default — the routes are not mounted at all, so
# /auth/sms/* returns 404. Set to true only together with the full credential
# set below; production refuses to boot if it is on and any of them is missing.
ENABLE_SMS_LOGIN=false
# SMS: Alibaba Cloud (https://dysms.console.aliyun.com)
ALIYUN_SMS_ACCESS_KEY_ID=
ALIYUN_SMS_ACCESS_KEY_SECRET=
ALIYUN_SMS_SIGN_NAME=佛津
ALIYUN_SMS_TEMPLATE_CODE=
# OAuth callback base URL (production: https://fojin.app)
OAUTH_REDIRECT_BASE=http://localhost:3000
# CORS(多个用逗号分隔,Docker 默认已含 localhost 端口)
# CORS_ORIGINS=http://localhost:3000,http://localhost:5173
# Umami Analytics(自托管,隐私友好,无 cookie)
# Generate with: python -c "import secrets; print(secrets.token_urlsafe(32))"
UMAMI_APP_SECRET=change-me-generate-a-random-secret
# umami 专用低权数据库账号(只能访问 umami 库,碰不到主 fojin 库)。留空则回退到
# 主 POSTGRES 账号(旧行为)。建议:CREATE ROLE umami LOGIN PASSWORD '…'; 让它拥有
# umami 库对象,并 REVOKE CONNECT ON DATABASE fojin FROM PUBLIC。
# UMAMI_DB_USER=umami
# UMAMI_DB_PASSWORD=
# 前端 Umami 注入(构建期 build args)— 两者都为空时前端不发任何遥测脚本,
# 这是 self-host 默认。设置后浏览器会加载 <VITE_UMAMI_URL> 并以 <VITE_UMAMI_WEBSITE_ID>
# 上报。一般指向自托管 Umami(例如 https://your-domain/umami/script.js)。
VITE_UMAMI_URL=
VITE_UMAMI_WEBSITE_ID=