add a separate config var for basic auth

This commit is contained in:
Kenneth Bingham 2023-11-15 20:15:06 -05:00
parent 8efdd06780
commit 3453dbd392
No known key found for this signature in database
GPG Key ID: 31709281860130B6
2 changed files with 13 additions and 10 deletions

View File

@ -92,17 +92,15 @@ else
if [[ -n "${ZROK_SHARE_OPTS:-}" ]]; then if [[ -n "${ZROK_SHARE_OPTS:-}" ]]; then
ZROK_CMD+=" ${ZROK_SHARE_OPTS}" ZROK_CMD+=" ${ZROK_SHARE_OPTS}"
fi fi
if [[ -n "${ZROK_OAUTH_PROVIDER:-}" ]]; then if [[ -n "${ZROK_BASIC_AUTH:-}" ]]; then
ZROK_CMD+=" --basic-auth ${ZROK_BASIC_AUTH}"
elif [[ -n "${ZROK_OAUTH_PROVIDER:-}" ]]; then
ZROK_CMD+=" --oauth-provider ${ZROK_OAUTH_PROVIDER}" ZROK_CMD+=" --oauth-provider ${ZROK_OAUTH_PROVIDER}"
fi if [[ -n "${ZROK_OAUTH_EMAILS:-}" ]]; then
if [[ -n "${ZROK_OAUTH_EMAILS:-}" ]]; then for EMAIL in ${ZROK_OAUTH_EMAILS}; do
for EMAIL in ${ZROK_OAUTH_EMAILS}; do ZROK_CMD+=" --oauth-email-domains ${EMAIL}"
if ! [[ ${EMAIL} =~ @ ]]; then done
echo "WARNING: '${EMAIL}' does not contain '@' so it may match more than one email domain!" >&2 fi
fi
ZROK_CMD+=" --oauth-email-domains ${EMAIL}"
done
fi
echo "INFO: running: zrok ${ZROK_CMD}" echo "INFO: running: zrok ${ZROK_CMD}"
zrok ${ZROK_CMD} | jq -rc | tee ~/.zrok/reserved.json zrok ${ZROK_CMD} | jq -rc | tee ~/.zrok/reserved.json
fi fi

View File

@ -73,6 +73,11 @@ ZROK_SHARE_OPTS=""
# WARNING: changing this value requires provisioning a new frontend URL # WARNING: changing this value requires provisioning a new frontend URL
#ZROK_OAUTH_EMAILS="bob@acme.example.com alice@forge.example.com @corp.example.com" #ZROK_OAUTH_EMAILS="bob@acme.example.com alice@forge.example.com @corp.example.com"
# you MAY require a password with HTTP basic authentication
# WARNING: changing this value requires provisioning a new frontend URL
# NOTE: basic auth and oauth are mutually exclusive
#ZROK_BASIC_AUTH=""
# set if self-hosting zrok and not using only the default frontend name 'public'; must be a space-separated list # set if self-hosting zrok and not using only the default frontend name 'public'; must be a space-separated list
# WARNING: changing this value requires provisioning a new frontend URL # WARNING: changing this value requires provisioning a new frontend URL
#ZROK_FRONTENDS="public" #ZROK_FRONTENDS="public"