From 6b06470e14e3393445d0d14d9d22797e5d960027 Mon Sep 17 00:00:00 2001 From: Hizkiel Date: Tue, 14 May 2024 15:08:43 +0200 Subject: [PATCH] add sub path option for deployment --- 40-create-ghcred.sh | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/40-create-ghcred.sh b/40-create-ghcred.sh index 70885a8..0d6448c 100755 --- a/40-create-ghcred.sh +++ b/40-create-ghcred.sh @@ -6,16 +6,34 @@ # Copy files with the specified public path #cp -r /usr/app/dist /usr/share/nginx/html/$VUE_APP_PUBLIC_PATH +#!/bin/bash + +# Remove leading and trailing whitespace and slashes +# Remove leading and trailing whitespace and slashes + +VUE_APP_PUBLIC_PATH=$(echo $VUE_APP_PUBLIC_PATH | xargs | sed 's/^\///;s/\/$//') + + echo $VUE_APP_PUBLIC_PATH -ln -s /usr/share/nginx/html /usr/share/nginx/html$VUE_APP_PUBLIC_PATH -#sed -e "//js/++mylocation/js" + +# Add leading slash only if string is not empty +if [ "$VUE_APP_PUBLIC_PATH" != "/" ] && [ "$VUE_APP_PUBLIC_PATH" != "" ]; then + VUE_APP_PUBLIC_PATH=/$VUE_APP_PUBLIC_PATH +fi +echo $VUE_APP_PUBLIC_PATH + + +ln -s /usr/share/nginx/html /usr/share/nginx/html/"$VUE_APP_PUBLIC_PATH" sed -i "s+/myAppPlaceholder+$VUE_APP_PUBLIC_PATH+g" /usr/share/nginx/html/index.html sed -i "s+/myAppPlaceholder+$VUE_APP_PUBLIC_PATH+g" /usr/share/nginx/html/js/app.*.js +# echo "no path" +# sed -i "s+myAppPlaceholder" "/" +# fi # Create nginx config from environment variables -# *prevent envsubst from killing nginx vars with 'tr' and '@'* -cat </GH_OAUTH_CLIENT.conf -set @CLIENT_ID $CLIENT_ID; -set @CLIENT_SECRET $CLIENT_SECRET; -set @CALL_BACK $CALL_BACK; -EOT +# # *prevent envsubst from killing nginx vars with 'tr' and '@'* +# cat </GH_OAUTH_CLIENT.conf +# set @CLIENT_ID $CLIENT_ID; +# set @CLIENT_SECRET $CLIENT_SECRET; +# set @CALL_BACK $CALL_BACK; +# EOT