Hello, not sure if I’m looking at a bug or if things just don’t work this way.
I’m using docker-compose to stand up authentik, postgres, redis.
docker-compose version 1.29.2
First why am I doing the below: I would like to keep the values of passwords/usernames in one location (one .env file) and then reference them from other .env files.
I have seperated out the env vars for the different services into their own .env file.
authentik-server:
env_file:
- ./configs/postgresql/.env
- ./configs/authentik/.env
For postgres/.env:
PG_PASS=Y1JWFVbgU35YlGZ7a3AwVBCFNK3QPyiTCSEqvvNF
PG_USER=postgres
PG_DB=postgres
POSTGRES_USER=${PG_USER}
POSTGRES_PASSWORD=${PG_PASS}
POSTGRES_DB=${PG_DB}
POSTGRES_PORT=5432
POSTGRES_HOST=postgresql
for authentik/.env:
AUTHENTIK_POSTGRESQL__HOST=${POSTGRES_HOST}
AUTHENTIK_POSTGRESQL__USER=${POSTGRES_USER}
AUTHENTIK_POSTGRESQL__PASSWORD=${$POSTGRES_PASSWORD}
The problem I’m running into is the AUTHENTIK_* vars are not assigned the values from the POSTGRES_* vars which are not contained in the same .env file. But the POSTGRES_* vars are assigned the values from the PG_* vars which are in the same .env file. I’m inspecting the env vars by running bash into the authentik-server container and $printenv.
The docs env_file say the order of the env_files matters and I have the postgres/.env listed before the authentik/.env file.
Anther thing I noticed is, if I put the POSTGRES_* AND PG_* VARS in the compose file under environment:
as a list they still don’t eval into the AUTHENTIK_* vars.
Thoughts/Suggestions? I maybe trying to do something that docker-compose is not designed for.
Thanks!