Skip to content

Commit 3994857

Browse files
author
Matt Pearson
committed
Move '--config-file' out of the args-parsing loop.
This should allow a config. file specified on the command-line to overwrite values set in '.env', which in turn ovewrite values set in the environment. Values set for these same vars in the args- parsing loop should then overwrite all of the above. Anything left unset by environment vars above are then covered when the "internal" vars are populated by the `var=${ENV_VAR:-default}` lines.
1 parent 676d33f commit 3994857

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

deploy.sh

+6-3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ main() {
77
source .env
88
fi
99

10+
# Set args from file specified on the command-line.
11+
if [[ $1 = "-c" || $1 = "--config-file" ]]; then
12+
source "$2"
13+
shift 2
14+
fi
15+
1016
# Parse arg flags
1117
# If something is exposed as an environment variable, set/overwrite it
1218
# here. Otherwise, set/overwrite the internal variable instead.
@@ -23,9 +29,6 @@ main() {
2329
elif [[ $1 = "-n" || $1 = "--no-hash" ]]; then
2430
GIT_DEPLOY_APPEND_HASH=false
2531
shift
26-
elif [[ $1 = "-c" || $1 = "--config-file" ]]; then
27-
source "$2"
28-
shift 2
2932
else
3033
break
3134
fi

0 commit comments

Comments
 (0)