In the Rancher environment variable, refer to the implementation of another environment variable in the value of one environment variable
1. At this stage, there are 4 Rancher environment variables (the default value is not set, it must be set), and its value includes the public part: dev.xxx.cn
PCS_API_CFG_SCMS_EDITOR_HOST_INFO=https://editor.dev.xxx.cn # 内容管理系统编辑器的 HOME URL
PCS_API_CFG_PCS_API_ASSET_HOST_INFO=https://web.dev.xxx.cn # 策划指挥系统接口的资源的 HOME URL
PCS_API_CFG_CPU_HOST_INFO=https://fcpu.dev.xxx.cn # CP上传的 HOME URL
PCS_API_CFG_SCMS_FRONT_HOST_INFO=https://web.dev.xxx.cn # 内容管理系统的 HTTP 客户端的前端的 HOME URL
2. In the new stage, update 4 Rancher environment variables (the default value has been set, and there is no need to set it). Add a new environment variable with a new value for the public part: rmt_main_domain
RMT_MAIN_DOMAIN=dev.xxx.cn # 融媒体环境的主域名
PCS_API_CFG_SCMS_EDITOR_HOST_INFO=https://editor.${RMT_MAIN_DOMAIN} # 内容管理系统编辑器的 HOME URL
PCS_API_CFG_PCS_API_ASSET_HOST_INFO=https://web.${RMT_MAIN_DOMAIN} # 策划指挥系统接口的资源的 HOME URL
PCS_API_CFG_CPU_HOST_INFO=https://fcpu.${RMT_MAIN_DOMAIN} # CP上传的 HOME URL
PCS_API_CFG_SCMS_FRONT_HOST_INFO=https://web.${RMT_MAIN_DOMAIN} # 内容管理系统的 HTTP 客户端的前端的 HOME URL
3. The shell script is shown below. as shown in Figure 1
# Rancher 环境变量(未设置默认值,必须设置)
if [[ `echo $RMT_MAIN_DOMAIN` == '' ]]
then
echo "需要设置 RMT_MAIN_DOMAIN"
exit 1
else
echo "设置的 RMT_MAIN_DOMAIN 为:$RMT_MAIN_DOMAIN"
fi
# Rancher 环境变量(已设置默认值,可无需设置)
env | grep "PCS_API_CFG_SCMS_EDITOR_HOST_INFO" || export PCS_API_CFG_SCMS_EDITOR_HOST_INFO="https://editor.${RMT_MAIN_DOMAIN}"
sed -i "s#PCS_API_CFG_SCMS_EDITOR_HOST_INFO#$PCS_API_CFG_SCMS_EDITOR_HOST_INFO#g" $DEV_COMMON_CONFIG_PARAMS_LOCAL_PATH
echo "PCS_API_CFG_SCMS_EDITOR_HOST_INFO replace $PCS_API_CFG_SCMS_EDITOR_HOST_INFO -> $DEV_COMMON_CONFIG_PARAMS_LOCAL_PATH"
echo "PCS_API_CFG_SCMS_EDITOR_HOST_INFO replace $PCS_API_CFG_SCMS_EDITOR_HOST_INFO -> $DEV_COMMON_CONFIG_PARAMS_LOCAL_PATH" >> $DIR/change.log
4. When the environment variable is not added in Rancher: rmt_main_domain, when the container is upgraded, an error is reported, as shown in Figure 2
/config/init/config0.sh: line 18: RMT_MAIN_DOMAIN: unbound variable
需要设置 RMT_MAIN_DOMAIN
5. When adding environment variables in Rancher: rmt_main_domain= , its value is an empty string, when the container is upgraded, an error is reported, as shown in Figure 3
需要设置 RMT_MAIN_DOMAIN
6. When adding an environment variable in Rancher: rmt_main_domain=dev.xxx.cn, the value is dev.xxx.cn, when the container is upgraded, the upgrade is successful, and the environment variable has taken effect. as shown in Figure 4
// 内容管理系统编辑器
'scmsEditor' => [
'hostInfo' => 'https://editor.dev.xxx.cn', // HOME URL
'baseUrl' => '', // BASE URL
],



