Jelajahi Sumber

Update init.sh.jinja2

qiaofeng1227 2 tahun lalu
induk
melakukan
3f8eda4a7e
1 mengubah file dengan 2 tambahan dan 1 penghapusan
  1. 2 1
      apps/roles/role_init/templates/init.sh.jinja2

+ 2 - 1
apps/roles/role_init/templates/init.sh.jinja2

@@ -45,7 +45,8 @@ app_url_replace=$(cat /data/apps/{{app_name}}/.env |grep APP_URL_REPLACE)
 if [ $app_url_replace = "APP_URL_REPLACE=true" ]; then
 if [ $app_url_replace = "APP_URL_REPLACE=true" ]; then
   echo "Change APP_URL" 1>> /tmp/init_debug.txt
   echo "Change APP_URL" 1>> /tmp/init_debug.txt
   public_ip=`wget -O - https://download.websoft9.com/ansible/get_ip.sh | bash`
   public_ip=`wget -O - https://download.websoft9.com/ansible/get_ip.sh | bash`
-  sudo sed -i "s/APP_URL=.*/APP_URL=$public_ip/g" /data/apps/{{app_name}}/.env
+  urlstr=`grep  "APP_URL=" /data/apps/{{app_name}}/.env |cut -d":" -f1`
+  sudo sed -i "s/$urlstr/APP_URL=$public_ip/g" /data/apps/{{app_name}}/.env
 else
 else
   echo "There is not APP_URL"
   echo "There is not APP_URL"
 fi 
 fi