mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-07-17 20:52:40 -04:00
Added trustedproxy to dynamic config feature.
This commit is contained in:
parent
910f12c25a
commit
db7eacbca3
@ -58,7 +58,7 @@ ENV REGEN_SESSIONKEY="false"
|
||||
ENV REVERSE_PROXY=""
|
||||
ENV REVERSE_PROXY_TLS_PORT="443"
|
||||
ENV WEBRTC="false"
|
||||
|
||||
ENV TRUSTED_PROXY=""
|
||||
|
||||
# MongoDB Variables
|
||||
ARG INCLUDE_MONGODB_TOOLS="false"
|
||||
|
@ -106,7 +106,7 @@ if [[ "$DYNAMIC_CONFIG" =~ ^(true|yes)$ ]]; then
|
||||
fi
|
||||
|
||||
# HOSTNAME
|
||||
if [[ -n $HOSTNAME ]] && [[ $HOSTNAME =~ ^[a-zA-Z0-9-]+$ ]]; then
|
||||
if [[ -n $HOSTNAME ]]; then
|
||||
echo "Setting hostname (cert)... $HOSTNAME"
|
||||
|
||||
jq --arg hostname "$HOSTNAME" \
|
||||
@ -159,6 +159,26 @@ if [[ "$DYNAMIC_CONFIG" =~ ^(true|yes)$ ]]; then
|
||||
sed -i 's/"AllowFraming":/"_AllowFraming":/g' "$CONFIG_FILE"
|
||||
fi
|
||||
|
||||
# trustedProxy
|
||||
if [[ -n $TRUSTED_PROXY ]]; then
|
||||
echo "Setting trustedProxy... - $REVERSE_PROXY_STRING"
|
||||
|
||||
if [[ $TRUSTED_PROXY == "all" ]]; then
|
||||
sed -i 's/"_trustedProxy"/"trustedProxy"/' "$CONFIG_FILE"
|
||||
jq --argjson trusted_proxy "true" \
|
||||
'.settings.trustedProxy = $trusted_proxy' \
|
||||
"$CONFIG_FILE" > temp_config.json && mv temp_config.json "$CONFIG_FILE"
|
||||
else
|
||||
sed -i 's/"_trustedProxy"/"trustedProxy"/' "$CONFIG_FILE"
|
||||
jq --argjson trusted_proxy "$TRUSTED_PROXY" \
|
||||
'.settings.trustedProxy = $trusted_proxy' \
|
||||
"$CONFIG_FILE" > temp_config.json && mv temp_config.json "$CONFIG_FILE"
|
||||
fi
|
||||
else
|
||||
echo "Invalid or no REVERSE_PROXY and/or REVERSE_PROXY_TLS_PORT value given, commenting out so default applies... Value(s) given: $REVERSE_PROXY_STRING"
|
||||
sed -i 's/"certUrl":/"_certUrl":/g' "$CONFIG_FILE"
|
||||
fi
|
||||
|
||||
# ALLOW_NEW_ACCOUNTS
|
||||
if [[ -n $ALLOW_NEW_ACCOUNTS ]] && [[ $ALLOW_NEW_ACCOUNTS =~ ^(true|false)$ ]]; then
|
||||
echo "Setting NewAccounts... $ALLOW_NEW_ACCOUNTS"
|
||||
@ -190,7 +210,7 @@ if [[ "$DYNAMIC_CONFIG" =~ ^(true|yes)$ ]]; then
|
||||
echo "Setting minify... $MINIFY"
|
||||
|
||||
sed -i 's/"_minify"/"minify"/' "$CONFIG_FILE"
|
||||
jq --arg minify "$MINIFY" \
|
||||
jq --argjson minify "$MINIFY" \
|
||||
'.domains[""].minify = $minify' \
|
||||
"$CONFIG_FILE" > temp_config.json && mv temp_config.json "$CONFIG_FILE"
|
||||
#sed -i "s/\"minify\": *[a-z]*/\"minify\": $MINIFY/" "$CONFIG_FILE"
|
||||
@ -204,7 +224,7 @@ if [[ "$DYNAMIC_CONFIG" =~ ^(true|yes)$ ]]; then
|
||||
echo "Setting allowedOrigin... $ALLOWED_ORIGIN"
|
||||
|
||||
sed -i 's/"_allowedOrigin"/"allowedOrigin"/' "$CONFIG_FILE"
|
||||
jq --arg allowed_origin "$ALLOWED_ORIGIN" \
|
||||
jq --argjson allowed_origin "$ALLOWED_ORIGIN" \
|
||||
'.domains[""].allowedOrigin = $allowed_origin' \
|
||||
"$CONFIG_FILE" > temp_config.json && mv temp_config.json "$CONFIG_FILE"
|
||||
else
|
||||
|
Loading…
x
Reference in New Issue
Block a user