uselotus / lotus

Open Source Pricing & Packaging Infrastructure
https://www.uselotus.io
MIT License
1.73k stars 126 forks source link

Docker compose `SVIX_DB_DSN` does not use `POSTGRES_USER` #788

Open jtagcat opened 9 months ago

jtagcat commented 9 months ago

Compose file defines: SVIX_DB_DSN: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db

# docker compose up -d
WARN[0000] The "POSTGRES_USER" variable is not set. Defaulting to a blank string. 
WARN[0000] The "POSTGRES_PASSWORD" variable is not set. Defaulting to a blank string.

Environment variables to be used within compose are read from the shell's environment or .env file in the same directory. env_file differs, it sets ENV from file, and cannot be referenced.

This issue has been annoying in other projects for me. One possible solution would be to move the constructor to .env.xyz file:

POSTGRES_USER=lotus
POSTGRES_PASSWORD=lotus
POSTGRES_DB=lotus
SVIX_DB_DSN=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db