Skip to content

Commit

Permalink
Read ironic htpasswd from file or env variable
Browse files Browse the repository at this point in the history
Signed-off-by: Mahnoor Asghar <[email protected]>
  • Loading branch information
MahnoorAsghar committed May 31, 2024
1 parent 4a2baed commit d05e890
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions scripts/auth-common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,11 @@ else
export IRONIC_EXPOSE_JSON_RPC="${IRONIC_EXPOSE_JSON_RPC:-false}"
fi

set +x
IRONIC_HTPASSWD_FILE=/etc/ironic/htpasswd
if [[ -f "/auth/ironic/username" ]]; then
IRONIC_HTPASSWD_USERNAME=$(</auth/ironic/username)
fi
IRONIC_HTPASSWD_USERNAME=${IRONIC_HTPASSWD_USERNAME:-}
if [[ -f "/auth/ironic/password" ]]; then
IRONIC_HTPASSWD_PASSWORD=$(</auth/ironic/password)
fi
IRONIC_HTPASSWD_PASSWORD=${IRONIC_HTPASSWD_PASSWORD:-}
if [[ -n "${IRONIC_HTPASSWD_USERNAME}" ]]; then
IRONIC_HTPASSWD="$(htpasswd -n -b -B "${IRONIC_HTPASSWD_USERNAME}" "${IRONIC_HTPASSWD_PASSWORD}")"
if [[ -f "/auth/ironic/htpasswd" ]]; then
IRONIC_HTPASSWD=$(</auth/ironic/htpasswd)
fi
export IRONIC_HTPASSWD=${IRONIC_HTPASSWD:-${HTTP_BASIC_HTPASSWD:-}}
set -x

configure_client_basic_auth()
{
Expand Down

0 comments on commit d05e890

Please sign in to comment.