Explorar el Código

Config only service that is defined in host.env

gabriel hace 6 años
padre
commit
f435a6abc3
Se han modificado 1 ficheros con 20 adiciones y 2 borrados
  1. 20 2
      nginx-config.sh

+ 20 - 2
nginx-config.sh

@@ -2,8 +2,26 @@
 export DOLAR='$'
 for fn in `ls /etc/nginx/conf.d/*.conf.tpl`; do
     echo $fn " -> " ${fn:0:(-4)}
-    envsubst < $fn > ${fn:0:(-4)}
-    cat ${fn:0:(-4)}
+    # remove .conf.tpl
+    fnn=${fn:0:(-9)}
+    # get the name of file
+    name=${fnn##*/}
+    # apply uppercase
+    name=${name^^}
+    # generete string to find
+    host_name="HOST_${name}="
+    # greo in host.env
+    module=$(set | grep ${host_name})
+    # get the url access
+    value=${module##*=}
+    # get length
+    exist=${#value}
+    if [ "${exist}" != "0" ];
+    then
+        # module is installed
+    	envsubst < $fn > ${fn:0:(-4)}
+	    cat ${fn:0:(-4)}
+    fi
 done