fix: pass MongoDB init credentials via env_file, not shell interpolation

This commit is contained in:
friday-bot 2026-05-27 17:02:53 -06:00
parent a50ce40d83
commit 8c2ddd2b2c
2 changed files with 8 additions and 10 deletions

View file

@ -38,16 +38,13 @@ services:
- internal - internal
env_file: env_file:
- stack.env - stack.env
environment:
- MONGO_INITDB_ROOT_USERNAME=${MONGO_USER}
- MONGO_INITDB_ROOT_PASSWORD=${MONGO_PASSWORD}
- MONGO_INITDB_DATABASE=mcdi
command: ["--auth", "--bind_ip_all"] command: ["--auth", "--bind_ip_all"]
healthcheck: healthcheck:
test: echo 'db.runCommand("ping").ok' | mongosh localhost:27017 --quiet test: ["CMD", "mongosh", "--quiet", "--eval", "db.adminCommand('ping')"]
interval: 30s interval: 10s
timeout: 10s timeout: 5s
retries: 5 retries: 10
start_period: 30s
networks: networks:
caddy_network: caddy_network:

View file

@ -1,8 +1,9 @@
CACHEBUST=1736003093 CACHEBUST=1736003093
# MongoDB # MongoDB
MONGO_USER=mcdi MONGO_INITDB_ROOT_USERNAME=mcdi
MONGO_PASSWORD=changeme-set-a-strong-password MONGO_INITDB_ROOT_PASSWORD=changeme-set-a-strong-password
MONGO_INITDB_DATABASE=mcdi
MONGODB_URI=mongodb://mcdi:changeme-set-a-strong-password@mongodb:27017/mcdi?authSource=admin MONGODB_URI=mongodb://mcdi:changeme-set-a-strong-password@mongodb:27017/mcdi?authSource=admin
# JWT # JWT