feat: configure XO reverse proxy options

This commit is contained in:
m0canu1
2026-09-04 15:49:20 +02:00
parent 776e448ce0
commit 0fe04c8b41

View File

@@ -53,6 +53,9 @@ INSTALL_REPOS="${INSTALL_REPOS:-"true"}"
SYSLOG_TARGET="${SYSLOG_TARGET:-""}"
YARN_CACHE_CLEANUP="${YARN_CACHE_CLEANUP:-"false"}"
YARN_NETWORK_TIMEOUT="${YARN_NETWORK_TIMEOUT:-"300000"}"
PUBLIC_URL="${PUBLIC_URL:-""}"
USE_FORWARDED_HEADERS="${USE_FORWARDED_HEADERS:-"false"}"
COOKIE_SECURE="${COOKIE_SECURE:-"false"}"
# set variables not changeable in configfile
TIME=$(date +%Y%m%d%H%M)
@@ -844,6 +847,21 @@ function InstallXO {
runcmd "sed -i \"/^\[logs.transport.syslog.*/a target = '$SYSLOG_TARGET'\" $INSTALLDIR/xo-builds/xen-orchestra-$TIME/packages/xo-server/sample.config.toml"
fi
if [[ -n "$PUBLIC_URL" ]]; then
printinfo "Setting public URL in xo-server configuration file"
runcmd "sed -i \"/^#publicUrl =.*/a publicUrl = '$PUBLIC_URL'\" $INSTALLDIR/xo-builds/xen-orchestra-$TIME/packages/xo-server/sample.config.toml"
fi
if [[ "$USE_FORWARDED_HEADERS" == "true" ]]; then
printinfo "Trusting forwarded headers in xo-server configuration file"
runcmd "sed -i \"s/#useForwardedHeaders = true/useForwardedHeaders = true/\" $INSTALLDIR/xo-builds/xen-orchestra-$TIME/packages/xo-server/sample.config.toml"
fi
if [[ "$COOKIE_SECURE" == "true" ]]; then
printinfo "Enabling secure cookies in xo-server configuration file"
runcmd "sed -i \"/^\[http.cookies\]/a secure = true\" $INSTALLDIR/xo-builds/xen-orchestra-$TIME/packages/xo-server/sample.config.toml"
fi
printinfo "Activating modified configuration file"
if ! [[ -d $CONFIGPATH/.config ]]; then
# create generic .config directory only if it doesn't exist as we set permissions to it