core/allow alternative postgres credentials
This commit allows the `dev-reset` command in the Makefile to pick up and use credentials from the `.env` file if they are present, or fallback to the defaults provided if they are not. This is the only place in the Makefile where the database credentials are used directly against postgresql binaries. The syntax was tested with bash, zsh, and csh, and did not fail under those. The `$${:-}` syntax is a combination of a Makefile idiom for "Pass a single `$` to the environment where this command will be executed," and the shell expresion `${VARIABLE:-default}` means "dereference the environment variable; if it is undefined, used the default value provided."
This commit is contained in:
parent
db2c0667a9
commit
f691c6896f
6
Makefile
6
Makefile
|
@ -219,9 +219,9 @@ install: web-install website-install
|
||||||
poetry install
|
poetry install
|
||||||
|
|
||||||
dev-reset:
|
dev-reset:
|
||||||
dropdb -U postgres -h localhost authentik
|
dropdb -U $${PG_USER:-postgres} -h $${PG_HOST:-localhost} $${PG_DB:-authentik}
|
||||||
# Also remove the test-db if it exists
|
# Also remove the test-db if it exists
|
||||||
dropdb -U postgres -h localhost test_authentik || true
|
dropdb -U $${PG_USER:-postgres} -h $${PG_HOST:-localhost} test_authentik || true
|
||||||
createdb -U postgres -h localhost authentik
|
createdb -U $${PG_USER:-postgres} -h $${PG_HOST:-localhost} $${PG_DB:-authentik}
|
||||||
redis-cli -n 0 flushall
|
redis-cli -n 0 flushall
|
||||||
make migrate
|
make migrate
|
||||||
|
|
Reference in New Issue