fix(content): harden Compose credential examples

This commit is contained in:
yeasy
2026-06-04 01:02:59 -07:00
parent 130d03bf65
commit 67d5fc775a
4 changed files with 9 additions and 8 deletions
+3 -3
View File
@@ -96,14 +96,14 @@ $ touch Gemfile.lock
### 11.7.5 步骤 3创建 compose.yaml
配置如下
配置如下下面为了本地练习使用环境变量占位不要把真实数据库密码写进 `compose.yaml``.env` Git生产环境应使用 Compose secretsRails credentials 或平台密钥管理
```yaml
services:
db:
image: postgres:16
environment:
POSTGRES_PASSWORD: password
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?set POSTGRES_PASSWORD}
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
@@ -123,7 +123,7 @@ services:
db:
condition: service_healthy
environment:
DATABASE_URL: postgres://postgres:password@db:5432/myapp_development
DATABASE_URL: postgres://postgres:${POSTGRES_PASSWORD:?set POSTGRES_PASSWORD}@db:5432/myapp_development
volumes:
postgres_data: