nex_buddy/.env.example

46 lines
1.9 KiB
Bash
Raw Permalink Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

# ---- 运行环境 ----
# 全部配置走环境变量/.env,不写进代码仓库(见 01-总体设计.md 第 8 节)
APP_ENV=dev
APP_VERSION=0.1.0
# ---- 端口 ----
# 开发:scripts/dev.sh 监听 BACKEND_PORT,Vite 监听 FRONTEND_PORT。
# Docker:这两个值是宿主机映射端口,容器内固定为 8000 / 80。
# localhost 的 CORS 源会自动跟随 FRONTEND_PORT;同域部署不需要额外配置 CORS。
BACKEND_PORT=8000
FRONTEND_PORT=5173
# ---- 数据库 ----
# 注意:Docker 容器里的 127.0.0.1 是容器自己,不是宿主机。
# 数据库在宿主机:用 host.docker.internal 或宿主机局域网 IP;
# 数据库是 Compose 服务:用服务名(如 postgres)。
DATABASE_URL=postgresql+asyncpg://postgres:sagacity@127.0.0.1:5432/nex_buddy
# Docker + 宿主机数据库示例:
# DATABASE_URL=postgresql+asyncpg://postgres:口令@host.docker.internal:5432/nex_buddy
# ---- 缓存 ----
# 同上:容器内不要写 127.0.0.1,除非 Redis 就在同一个容器里。
REDIS_URL=redis://127.0.0.1:6379/9
# Docker + 宿主机缓存示例:
# REDIS_URL=redis://host.docker.internal:6379/9
# ---- 和风天气 ----
# Key / Host 只保存在数据库,由管理端「平台设置」维护;这里不再读取。
# ---- 业务参数 ----
SESSION_TTL_SECONDS=604800
PAIR_CODE_TTL_SECONDS=600
WEATHER_CACHE_SECONDS=1800
DEFAULT_CITY=杭州
# ---- 资源目录 ----
# 裸机/systemd 部署用:默认是项目根 data/。
# Docker 部署固定使用容器内 /app/data,由 docker-compose.yml 挂载,不需要在这里配置。
# DATA_DIR=/srv/nex_buddy/data
# ---- CORS(一般不用配) ----
# Web 与 API 同域部署(Nginx 反代 / 已配 WEB_BASE_URL)时不需要 CORS,
# 保持不设置即可。只有 Web 与 API 确实不同域时才需要:
# CORS_ORIGINS=https://app.example.com
# 注意写完整源(协议 + 域名 + 端口),不要用 *。