Merge pull request #124 from useplunk/canary
Fix: Improved startup script
This commit is contained in:
Regular → Executable
+20
-4
@@ -7,10 +7,26 @@ if [ -z "${API_URI}" ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Find and replace baked values with real values for the API_URI
|
if [ -z "${AWS_REGION}" ]; then
|
||||||
find /app/packages/dashboard/public /app/packages/dashboard/.next -type f -name "*.js" |
|
echo "AWS_REGION is not set. Exiting..."
|
||||||
while read file; do
|
exit 1
|
||||||
sed -i "s|PLUNK_API_URI|${API_URI}|g" "$file"
|
fi
|
||||||
|
|
||||||
|
# Process each directory that might contain JS files
|
||||||
|
for dir in "/app/packages/dashboard/public" "/app/packages/dashboard/.next"; do
|
||||||
|
if [ -d "$dir" ]; then
|
||||||
|
# Find all JS files and process them
|
||||||
|
find "$dir" -type f -name "*.js" -o -name "*.mjs" | while read -r file; do
|
||||||
|
if [ -f "$file" ]; then
|
||||||
|
# Replace environment variables
|
||||||
|
sed -i "s|PLUNK_API_URI|${API_URI}|g" "$file"
|
||||||
|
sed -i "s|PLUNK_AWS_REGION|${AWS_REGION}|g" "$file"
|
||||||
|
echo "Processed: $file"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
else
|
||||||
|
echo "Warning: Directory $dir does not exist, skipping..."
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "Environment Variables Baked."
|
echo "Environment Variables Baked."
|
||||||
Reference in New Issue
Block a user