feat: add possibility to use custom listen address in XO config
This commit is contained in:
@@ -22,6 +22,11 @@ PORT="80"
|
||||
# Port number to where xo-proxy service is bound
|
||||
PROXY_PORT="443"
|
||||
|
||||
# IP-address which xo-server listens to
|
||||
# By default XO will listen to all available IPv6 addresses and if none exists, all IPv4 addresses
|
||||
# With this you can force XO to listen only specific address, or e.g. all IPv4 addresses with 0.0.0.0
|
||||
#LISTEN_ADDRESS="0.0.0.0"
|
||||
|
||||
# Base dir for installation and future updates
|
||||
INSTALLDIR="/opt/xo"
|
||||
|
||||
|
@@ -23,6 +23,7 @@ source "$CONFIG_FILE"
|
||||
# Set some default variables if sourcing config file fails for some reason
|
||||
SELFUPGRADE=${SELFUPGRADE:-"true"}
|
||||
PORT=${PORT:-80}
|
||||
LISTEN_ADDRESS=${LISTEN_ADDRESS:-""}
|
||||
PROXY_PORT=${PROXY_PORT:-443}
|
||||
INSTALLDIR=${INSTALLDIR:-"/opt/xo"}
|
||||
BRANCH=${BRANCH:-"master"}
|
||||
@@ -789,6 +790,11 @@ function InstallXO {
|
||||
sleep 2
|
||||
fi
|
||||
|
||||
if [[ -n "$LISTEN_ADDRESS" ]]; then
|
||||
printinfo "Changing listen address in xo-server configuration file"
|
||||
runcmd "sed -i \"s%^# hostname = 'localhost'%hostname = '$LISTEN_ADDRESS'%\" $INSTALLDIR/xo-builds/xen-orchestra-$TIME/packages/xo-server/sample.config.toml"
|
||||
fi
|
||||
|
||||
if [[ "$HTTPS" == "true" ]]; then
|
||||
printinfo "Enabling HTTPS in xo-server configuration file"
|
||||
# shellcheck disable=SC1117
|
||||
@@ -1450,6 +1456,9 @@ function StartUpScreen {
|
||||
echo -e "Basedir: ${COLOR_WHITE}$INSTALLDIR ${COLOR_N}"
|
||||
echo -e "User: ${COLOR_WHITE}$XOUSER ${COLOR_N}"
|
||||
echo -e "Port: ${COLOR_WHITE}$PORT${COLOR_N}"
|
||||
if [[ -n "$LISTEN_ADDRESS" ]]; then
|
||||
echo -e "Listen address: ${COLOR_WHITE}$LISTEN_ADDRESS${COLOR_N}"
|
||||
fi
|
||||
echo -e "HTTPS: ${COLOR_WHITE}${HTTPS}${COLOR_N}"
|
||||
echo -e "Git Branch for source: ${COLOR_WHITE}$BRANCH${COLOR_N}"
|
||||
echo -e "Following plugins will be installed: ${COLOR_WHITE}$PLUGINS${COLOR_N}"
|
||||
|
Reference in New Issue
Block a user