fix: load local env file correctly in backup script
All checks were successful
ITAM Code Check / build-and-config-check (push) Successful in 20s
All checks were successful
ITAM Code Check / build-and-config-check (push) Successful in 20s
This commit is contained in:
@@ -28,9 +28,14 @@ has_command() {
|
|||||||
load_env() {
|
load_env() {
|
||||||
[ -f "$ENV_FILE" ] || fail "Env file not found: $ENV_FILE"
|
[ -f "$ENV_FILE" ] || fail "Env file not found: $ENV_FILE"
|
||||||
|
|
||||||
|
case "$ENV_FILE" in
|
||||||
|
*/*) env_path="$ENV_FILE" ;;
|
||||||
|
*) env_path="./$ENV_FILE" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
set -a
|
set -a
|
||||||
# shellcheck disable=SC1090
|
# shellcheck disable=SC1090
|
||||||
. "$ENV_FILE"
|
. "$env_path"
|
||||||
set +a
|
set +a
|
||||||
|
|
||||||
: "${DB_HOST:?DB_HOST is required in $ENV_FILE}"
|
: "${DB_HOST:?DB_HOST is required in $ENV_FILE}"
|
||||||
|
|||||||
Reference in New Issue
Block a user