refactor: 统一配置文件系统
- 补全 backend/config.yaml 所有非敏感配置项并添加中文注释
- 重写 config.go:Load(workDir) 显式传参,BindEnv 绑定敏感字段,删除 AutomaticEnv
- setDefaults 默认值与 config.yaml 保持一致(mimo/dashscope)
- backend/.env.example 重写为纯敏感信息模板
- .env 固定在 /opt/camtalk/.env,docker-compose 通过绝对路径加载
- deploy.sh 统一使用 --env-file,移除硬编码 IP
- deploy.yml 删除 CI 写入 .env 的步骤
- Dockerfile 移除 COPY config.yaml
- 修复 deploy.yml 中 POSTGRES_PASSWORD 的 &{{ 拼写错误
This commit is contained in:
@@ -17,11 +17,11 @@ services:
|
||||
context: ./backend
|
||||
dockerfile: Dockerfile
|
||||
container_name: camtalk-backend
|
||||
env_file:
|
||||
- /opt/camtalk/.env
|
||||
environment:
|
||||
- APP_ENV=production
|
||||
- CAMTALK_STORAGE_DRIVER=postgres
|
||||
- CAMTALK_STORAGE_DSN=postgres://camtalk:camtalk123@postgres:5432/camtalk?sslmode=disable
|
||||
- CAMTALK_AUTH_JWT_SECRET=78uWBBAF8XEQEotKDlrnlnd4y8i4WN3E4zXmNmC8BYQ=
|
||||
- CAMTALK_STORAGE_DRIVER=${CAMTALK_STORAGE_DRIVER:-postgres}
|
||||
- CAMTALK_STORAGE_DSN=postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/camtalk?sslmode=disable
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
@@ -30,12 +30,11 @@ services:
|
||||
restart: unless-stopped
|
||||
|
||||
postgres:
|
||||
# 轩辕镜像加速,避免 Docker Hub 拉取超时
|
||||
image: docker.m.daocloud.io/library/postgres:15-alpine
|
||||
container_name: camtalk-postgres
|
||||
environment:
|
||||
POSTGRES_USER: camtalk
|
||||
POSTGRES_PASSWORD: camtalk123
|
||||
POSTGRES_USER: ${POSTGRES_USER}
|
||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
|
||||
POSTGRES_DB: camtalk
|
||||
volumes:
|
||||
- pgdata:/var/lib/postgresql/data
|
||||
@@ -43,7 +42,7 @@ services:
|
||||
networks:
|
||||
- camtalk-net
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U camtalk -d camtalk"]
|
||||
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d camtalk"]
|
||||
interval: 5s
|
||||
timeout: 3s
|
||||
retries: 10
|
||||
|
||||
Reference in New Issue
Block a user