File tree Expand file tree Collapse file tree 1 file changed +22
-5
lines changed Expand file tree Collapse file tree 1 file changed +22
-5
lines changed Original file line number Diff line number Diff line change 1
- #! /bin/bash
1
+ #! /usr/bin/env bash
2
+ set -e
2
3
3
4
echo " Baking Environment Variables..."
4
5
@@ -7,10 +8,26 @@ if [ -z "${NEXT_PUBLIC_API_URI}" ]; then
7
8
exit 1
8
9
fi
9
10
10
- # Find and replace baked values with real values for the API_URI
11
- find /app/packages/dashboard/public /app/packages/dashboard/.next -type f -name " *.js" |
12
- while read file; do
13
- sed -i " s|PLUNK_API_URI|${NEXT_PUBLIC_API_URI} |g" " $file "
11
+ if [ -z " ${NEXT_PUBLIC_AWS_REGION} " ]; then
12
+ echo " NEXT_PUBLIC_AWS_REGION is not set. Exiting..."
13
+ exit 1
14
+ fi
15
+
16
+ # Process each directory that might contain JS files
17
+ for dir in " /app/packages/dashboard/public" " /app/packages/dashboard/.next" ; do
18
+ if [ -d " $dir " ]; then
19
+ # Find all JS files and process them
20
+ find " $dir " -type f -name " *.js" -o -name " *.mjs" | while read -r file; do
21
+ if [ -f " $file " ]; then
22
+ # Replace environment variables
23
+ sed -i " s|PLUNK_API_URI|${NEXT_PUBLIC_API_URI} |g" " $file "
24
+ sed -i " s|PLUNK_AWS_REGION|${NEXT_PUBLIC_AWS_REGION} |g" " $file "
25
+ echo " Processed: $file "
26
+ fi
27
+ done
28
+ else
29
+ echo " Warning: Directory $dir does not exist, skipping..."
30
+ fi
14
31
done
15
32
16
33
echo " Environment Variables Baked."
You can’t perform that action at this time.
0 commit comments