Files
HangmanLab.Frontend/BuildConfig.sh
2024-12-05 13:39:08 +00:00

37 lines
905 B
Bash
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#/bin/bash
rm -f /app/config.js;
if [ -z "$BACKEND_HOST" ]; then
BACKEND_HOST="http://localhost:5000"
fi
if [ -z "$FRONTEND_HOST" ]; then
FRONTEND_HOST="http://localhost:3000"
fi
if [ -z "$KC_CLIENT_ID" ]; then
KC_CLIENT_ID="labdev"
fi
if [ -z "$KC_HOST" ]; then
KC_HOST="https://login.hangman-lab.top"
fi
if [ -z "$KC_REALM" ]; then
KC_REALM="Hangman-Lab"
fi
mkdir -p /app/src
echo "
const config = {
BACKEND_HOST: \"${BACKEND_HOST}\",
FRONTEND_HOST: \"${FRONTEND_HOST}\",
KC_CLIENT_ID: \"${KC_CLIENT_ID}\",
OIDC_CONFIG: {
authority: \"${KC_HOST}/realms/${KC_REALM}\",
client_id: \"${KC_CLIENT_ID}\",
redirect_uri: \"${FRONTEND_HOST}/callback\",
post_logout_redirect_uri: \"${FRONTEND_HOST}\",
response_type: \"code\",
scope: \"openid profile email roles\",
},
};
export default config;
" > /app/src/config.js;