0
Fork 0
mirror of https://codeberg.org/SafeTwitch/safetwitch.git synced 2024-12-22 05:12:57 -05:00

Fix docker env not updating

This commit is contained in:
dragongoose 2023-05-08 20:34:30 -04:00
parent 55dbfc4831
commit 214bc04ce0
No known key found for this signature in database
GPG key ID: 50DB99B921579009
2 changed files with 24 additions and 3 deletions

2
.gitignore vendored
View file

@ -26,3 +26,5 @@ coverage
*.njsproj *.njsproj
*.sln *.sln
*.sw? *.sw?
.env.old

View file

@ -1,15 +1,34 @@
#!/bin/sh #!/bin/sh
ROOT_DIR=/app ROOT_DIR=/app
# Save old variables
# Get old vars
if [ -f .env.old ]; then
export $(echo $(cat .env.old | sed 's/#.*//g'| xargs) | envsubst)
else
export VITE_BACKEND_DOMAIN_PLACEHOLDER=VITE_BACKEND_DOMAIN_PLACEHOLDER
export VITE_INSTANCE_DOMAIN_PLACEHOLDER=VITE_INSTANCE_DOMAIN_PLACEHOLDER
export VITE_HTTPS_PLACEHOLDER=VITE_HTTPS_PLACEHOLDER
fi
echo $VITE_BACKEND_DOMAIN_PLACEHOLDER
# Replace env vars in files served by NGINX # Replace env vars in files served by NGINX
for file in $ROOT_DIR/assets/*.js $ROOT_DIR/index.html; for file in $ROOT_DIR/assets/*.js $ROOT_DIR/index.html;
do do
sed -i 's|VITE_BACKEND_DOMAIN_PLACEHOLDER|'${VITE_BACKEND_DOMAIN}'|g' $file sed -i 's|'${VITE_BACKEND_DOMAIN_PLACEHOLDER}'|'${VITE_BACKEND_DOMAIN}'|g' $file
sed -i 's|VITE_INSTANCE_DOMAIN_PLACEHOLDER|'${VITE_INSTANCE_DOMAIN}'|g' $file sed -i 's|'${VITE_INSTANCE_DOMAIN_PLACEHOLDER}'|'${VITE_INSTANCE_DOMAIN}'|g' $file
sed -i 's|VITE_HTTPS_PLACEHOLDER|'${VITE_HTTPS}'|g' $file sed -i 's|'${VITE_HTTPS_PLACEHOLDER}'|'${VITE_HTTPS}'|g' $file
# Your other variables here... # Your other variables here...
done done
echo ${VITE_BACKEND_DOMAIN_PLACEHOLDER}
# Save old variables
echo -e "VITE_BACKEND_DOMAIN_PLACEHOLDER=${VITE_BACKEND_DOMAIN_PLACEHOLDER}" > .env.old
echo -e "VITE_INSTANCE_DOMAIN_PLACEHOLDER=${VITE_INSTANCE_DOMAIN_PLACEHOLDER}" >> .env.old
echo -e "VITE_HTTPS_PLACEHOLDER=${VITE_HTTPS_PLACEHOLDER}" >> .env.old
# Starting NGINX # Starting NGINX
nginx -g 'daemon off;' nginx -g 'daemon off;'