This commit is contained in:
2024-06-13 23:09:54 +02:00
parent d524a831cd
commit eeae861353

View File

@@ -4,7 +4,7 @@
set -e
# Set up endpoint for env retrieval
echo "window._env_ = {" > /usr/share/nginx/html/env_config.js
echo "window._env_ = {" > /usr/share/nginx/html/env-config.js
# Collect enviroment variables for react
eval enviroment_variables="$(env | grep REACT_APP.*=)"
@@ -12,7 +12,7 @@ eval enviroment_variables="$(env | grep REACT_APP.*=)"
# Loop over variables
env | grep REACT_APP.*= | while read -r line;
do
printf "%s',\n" $line | sed "s/=/:'/" >> /usr/share/nginx/html/env_config.js
printf "%s',\n" $line | sed "s/=/:'/" >> /usr/share/nginx/html/env-config.js
# Notify the user
printf "Env variable %s' was injected into React App. \n" $line | sed "0,/=/{s//:'/}"
@@ -20,7 +20,7 @@ do
done
# End the object creation
echo "}" >> /usr/share/nginx/html/env_config.js
echo "}" >> /usr/share/nginx/html/env-config.js
echo "Enviroment Variable Injection Complete."