File tree Expand file tree Collapse file tree 2 files changed +26
-5
lines changed
Expand file tree Collapse file tree 2 files changed +26
-5
lines changed Original file line number Diff line number Diff line change 11. ./ scripts/ loadenv.ps1
22
3- if (-not $env: AZURE_APP_SAMPLE_ENABLED -or $env: AZURE_APP_SAMPLE_ENABLED -eq " false" ) {
4- Write-Host " AZURE_APP_SAMPLE_ENABLED is false. Exiting auth_init script."
3+ $appSampleEnabled = (Get-Content .\.azure\$env: AZURE_ENV_NAME \config.json | ConvertFrom-Json ).infra.parameters.appSampleEnabled
4+
5+ # Give preference to AZURE_APP_SAMPLE_ENABLED environment variable
6+ if ($env: AZURE_APP_SAMPLE_ENABLED ) {
7+ $effectiveValue = $env: AZURE_APP_SAMPLE_ENABLED
8+ } else {
9+ $effectiveValue = $appSampleEnabled
10+ }
11+
12+ $effectiveValue = $effectiveValue.ToString ().ToLower()
13+
14+ if (-not $effectiveValue -or $effectiveValue -eq " false" ) {
15+ Write-Host " App sample is disabled. Exiting auth_init script."
516 exit
617}
718
Original file line number Diff line number Diff line change 33# Load environment variables from a shell script
44. ./scripts/loadenv.sh
55
6- # Check if AZURE_APP_SAMPLE_ENABLED is not set or is "false"
7- if [[ -z " $AZURE_APP_SAMPLE_ENABLED " || " $AZURE_APP_SAMPLE_ENABLED " == " false" ]]; then
8- echo " AZURE_APP_SAMPLE_ENABLED is false. Exiting auth_init script."
6+ appSampleEnabled=$( ./.venv/bin/python -c " import json; print(str(json.load(open('.azure/$AZURE_ENV_NAME /config.json'))['infra']['parameters']['appSampleEnabled']).lower())" 2> /dev/null || echo " false" )
7+
8+ # Give preference to AZURE_APP_SAMPLE_ENABLED environment variable
9+ if [[ -n " $AZURE_APP_SAMPLE_ENABLED " ]]; then
10+ effectiveValue=" ${AZURE_APP_SAMPLE_ENABLED} "
11+ else
12+ effectiveValue=" $appSampleEnabled "
13+ fi
14+
15+ effectiveValue=$( echo " $effectiveValue " | tr ' [:upper:]' ' [:lower:]' )
16+
17+ if [[ -z " $effectiveValue " || " $effectiveValue " == " false" ]]; then
18+ echo " App sample is disabled. Exiting auth_init script."
919 exit 0
1020fi
1121
You can’t perform that action at this time.
0 commit comments