Skip to content

Commit

Permalink
Merge pull request #54 from OsiriX-Foundation/nikpap_unige_k8s
Browse files Browse the repository at this point in the history
Update Authorization for kubernetes
  • Loading branch information
nikpap authored Jul 6, 2022
2 parents 8b86ba5 + 83fa36f commit ca22f23
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions Authorization/setenv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ check_env() {
check_secrets() {
local missing_secret=false;

while [[ -n $1 ]]; do
while [[ -n $1 ]]; do
local var="$1"
if [[ -f $var ]]; then
word_count=$(wc -w "$var" | cut -f1 -d" ")
Expand All @@ -35,9 +35,12 @@ check_secrets() {
fi
shift
done

if [[ $missing_secret = true ]]; then
exit 1
fi

echo "Finished checking secrets, none missing"
}

check_env "KHEOPS_AUTHDB_USER" \
Expand Down Expand Up @@ -76,6 +79,7 @@ do
line_count=$(wc -l $f | cut -f1 -d" ")

if [ ${word_count} != 1 ] || [ ${line_count} != 1 ]; then

echo Error with secret $filename. He contains $word_count word and $line_count line
exit 1
fi
Expand All @@ -94,7 +98,17 @@ sed -i "s|\${kheops_pacs_url}|http://$KHEOPS_PACS_PEP_HOST:$KHEOPS_PACS_PEP_PORT

sed -i "s|\${kheops_client_dicomwebproxyclientid}|$KHEOPS_CLIENT_DICOMWEBPROXYCLIENTID|" ${REPLACE_FILE_PATH}
sed -i "s|\${kheops_client_zipperclientid}|$KHEOPS_CLIENT_ZIPPERCLIENTID|" ${REPLACE_FILE_PATH}
sed -i "s|\${kheops_oidc_provider}|$KHEOPS_OIDC_PROVIDER|" ${REPLACE_FILE_PATH}

# Kubernetes: use $KHEOPS_AUTH_OIDC_PROVIDER instead of KHEOPS_OIDC_PROVIDER

if [ -n "$KHEOPS_AUTH_OIDC_PROVIDER" ]; then
echo "Using KHEOPS_AUTH_OIDC_PROVIDER"
sed -i "s|\${kheops_oidc_provider}|$KHEOPS_AUTH_OIDC_PROVIDER|" ${REPLACE_FILE_PATH}
else
echo "Using KHEOPS_OIDC_PROVIDER"
sed -i "s|\${kheops_oidc_provider}|$KHEOPS_OIDC_PROVIDER|" ${REPLACE_FILE_PATH}
fi

sed -i "s|\${kheops_oauth_scope}|$KHEOPS_OAUTH_SCOPE|" ${REPLACE_FILE_PATH}
sed -i "s|\${kheops_welcomebot_webhook}|$KHEOPS_WELCOMEBOT_WEBHOOK|" ${REPLACE_FILE_PATH}

Expand Down

0 comments on commit ca22f23

Please sign in to comment.