Skip to content

Commit 97c19af

Browse files
committed
Fix post-install script failing on MacOS with unbound variable error
Fixes #90 The post-install script was failing when DDEV_UPSTREAM_PROVIDER was not defined in the .env file. The script uses 'set -u' flag (via pipefail) which treats unset variables as errors. Changed the conditional check from '$DDEV_UPSTREAM_PROVIDER' to '${DDEV_UPSTREAM_PROVIDER:-}' to use parameter expansion that provides an empty string if the variable is unset, preventing the script from failing when the variable doesn't exist.
1 parent d772055 commit 97c19af

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

install.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ post_install_actions:
135135
- |
136136
if [ -f .env ]; then
137137
source ".env"
138-
if [[ $DDEV_UPSTREAM_PROVIDER ]]; then
138+
if [[ ${DDEV_UPSTREAM_PROVIDER:-} ]]; then
139139
ddev dotenv set .ddev/.env.anner --ddev-upstream-provider $DDEV_UPSTREAM_PROVIDER
140140
git add .env.anner
141141
# Remove our old .env file

0 commit comments

Comments
 (0)