Read `cron.database_name` from environment variables (`$PGDATABASE`)
sepsol opened this issue · 0 comments
I am bind-mounting a configs directory from my host machine that is tracked by git, to the docker container running postgres. The reason for using a volume is to have the config changes be applied immediately to the database. The only thing stopping me from completing this setup is that I have to hardcode my database name in the configs which I don't like since this repository is tracked by git and is a template repository that I plan to use for all my other microservices.
Originally, I was copying configs during db initialization and used envsubst
command to replace ${PGDATABASE}
in cron.database_name = '${PGDATABASE}'
with my actual database name. But this wouldn't work with volumes. Therefore, I thought to reach out here and ask that pg_cron
respects standard postgres environment variables in future updates. For now, I have to either live without volumes or hardcode my db name to my config files which is not ideal.