Skip to content

Commit

Permalink
Use config from global environment in non-interactive mode
Browse files Browse the repository at this point in the history
  • Loading branch information
martin-helmich committed Feb 19, 2024
1 parent a2a22bf commit 3236089
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
1 change: 1 addition & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ jobs:
- uses: ddev/github-action-add-on-test@v1
env:
MITTWALD_API_TOKEN: foo
MITTWALD_APP_INSTALLATION_ID: a-XXXXXX
with:
ddev_version: ${{ matrix.ddev_version }}
token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
30 changes: 20 additions & 10 deletions install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,18 @@ pre_install_actions:
#ddev-nodisplay
if !( {{ contains "MITTWALD_API_TOKEN" (list .DdevGlobalConfig.web_environment | toString) }} || {{ contains "MITTWALD_API_TOKEN" (list .DdevProjectConfig.web_environment | toString) }} ); then
if [[ -n "${DDEV_NONINTERACTIVE}" ]] ; then
echo "MITTWALD_API_TOKEN not set; please provide one in the web_environment configuration" >&2
exit 1
if [[ -n "${MITTWALD_API_TOKEN}" ]] ; then
ddev config global --web-environment-add MITTWALD_API_TOKEN=${MITTWALD_API_TOKEN}
echo "MITTWALD_API_TOKEN set globally"
else
echo "MITTWALD_API_TOKEN not set; please provide one in the web_environment configuration" >&2
exit 1
fi
else
read -s token
ddev config global --web-environment-add MITTWALD_API_TOKEN=${token}
echo "MITTWALD_API_TOKEN set globally"
fi
read -s token
ddev config global --web-environment-add MITTWALD_API_TOKEN=${token}
echo "MITTWALD_API_TOKEN set globally"
fi
- |
Expand All @@ -37,11 +42,16 @@ pre_install_actions:
#ddev-nodisplay
if !( {{ contains "MITTWALD_APP_INSTALLATION_ID" (list .DdevProjectConfig.web_environment | toString) }} ); then
if [[ -n "${DDEV_NONINTERACTIVE}" ]] ; then
echo "MITTWALD_APP_INSTALLATION_ID not set; please provide one in the web_environment configuration" >&2
exit 1
if [[ -n "${MITTWALD_APP_INSTALLATION_ID}" ]] ; then
ddev config --web-environment-add MITTWALD_APP_INSTALLATION_ID=${MITTWALD_APP_INSTALLATION_ID}
else
echo "MITTWALD_APP_INSTALLATION_ID not set; please provide one in the web_environment configuration" >&2
exit 1
fi
else
read app_id
ddev config --web-environment-add MITTWALD_APP_INSTALLATION_ID=${app_id}
fi
read app_id
ddev config --web-environment-add MITTWALD_APP_INSTALLATION_ID=${app_id}
fi
Expand Down

0 comments on commit 3236089

Please sign in to comment.