Skip to content

Commit

Permalink
add sub path option for deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
hizclick committed May 14, 2024
1 parent 680f8bd commit 6b06470
Showing 1 changed file with 26 additions and 8 deletions.
34 changes: 26 additions & 8 deletions 40-create-ghcred.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 <<EOT | envsubst | tr '@' '$' >/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 <<EOT | envsubst | tr '@' '$' >/GH_OAUTH_CLIENT.conf
# set @CLIENT_ID $CLIENT_ID;
# set @CLIENT_SECRET $CLIENT_SECRET;
# set @CALL_BACK $CALL_BACK;
# EOT

0 comments on commit 6b06470

Please sign in to comment.