-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path40-create-ghcred.sh
executable file
·24 lines (20 loc) · 1.04 KB
/
40-create-ghcred.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/sh
# Set default value for VUE_APP_PUBLIC_PATH if not provided
# Remove leading and trailing whitespace and slashes from VUE_APP_PUBLIC_PATH
VUE_APP_PUBLIC_PATH=$(echo $VUE_APP_PUBLIC_PATH | sed 's/^\s*\///;s/\/\s*$//')
# 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
# Link the Vue.js app to the 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
# Create NGINX configuration from environment variables
# The @ character is used to prevent envsubst from interpreting NGINX variables
cat <<EOT | envsubst | tr '@' '$' >/GH_OAUTH_CLIENT.conf
# Handle CLIENT_ID, CLIENT_SECRET, and CALL_BACK - they can be empty
set @CLIENT_ID "${CLIENT_ID:-}";
set @CLIENT_SECRET "${CLIENT_SECRET:-}";
set @CALL_BACK "${CALL_BACK:-}";
EOT