In the shell script, avoid $appid$ to report an error: /config/init/config0.sh: line 184 appid unbound variable (prevent variables from being replaced)
1. In the shell script, an error is reported at runtime: /config/init/config0.sh line 184 appid unbound variable. as shown in Figure 1
/config/init/config0.sh: line 184: APPID: unbound variable
2. Check the shell script, its value is:https://console.${RMT_MAIN_DOMAIN}/ccpauth/wx-msg-event/$APPID$/receive. ${rmt_main_domain} needs to be replaced with: dev.xxx.cn. $appId$ does not need to be replaced, it is left as it is, but now it is treated as a variable. Therefore, an error is reported.
if [[ `echo $RMT_MAIN_DOMAIN` == '' ]]
then
echo "需要设置 RMT_MAIN_DOMAIN"
exit 1
else
echo "设置的 RMT_MAIN_DOMAIN 为:$RMT_MAIN_DOMAIN"
fi
env | grep "CHANNEL_PUB_API_CFG_WX_OPEN_COMPONENT_MSG_EVENT_RECEIVE" || export CHANNEL_PUB_API_CFG_WX_OPEN_COMPONENT_MSG_EVENT_RECEIVE="https://console.${RMT_MAIN_DOMAIN}/ccpauth/wx-msg-event/$APPID$/receive"
3. Edit the shell script, $appid$ is modified to:\$appid\$. Add escape characters before $. The code is as follows
env | grep "CHANNEL_PUB_API_CFG_WX_OPEN_COMPONENT_MSG_EVENT_RECEIVE" || export CHANNEL_PUB_API_CFG_WX_OPEN_COMPONENT_MSG_EVENT_RECEIVE="https://console.${RMT_MAIN_DOMAIN}/ccpauth/wx-msg-event/\$APPID\$/receive"
4. When running, no more errors are reported. Check the run log, no errors are reported again. as shown in Figure 2
CHANNEL_PUB_API_CFG_WX_OPEN_COMPONENT_MSG_EVENT_RECEIVE replace https://console.dev.xxx.cn/ccpauth/wx-msg-event/$APPID$/receive -> /mcloud/www/ccp_api/environments/dev/common/config/params-local.php
5. Check the final replacement result in /mcloud/www/ccp_api/environments/dev/common/config/params-local.php . ${rmt_main_domain} needs to be replaced with: dev.xxx.cn. $appId$ does not need to be replaced, left as it is. in line with expectations. as shown in Figure 3


