Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace NEXT_PUBLIC_API_URI instead of API_URI #119

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions deployment/replace-variables.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
#!/bin/bash
#!/usr/bin/env bash
set -e

echo "Baking Environment Variables..."

if [ -z "${API_URI}" ]; then
echo "API_URI is not set. Exiting..."
if [ -z "${NEXT_PUBLIC_API_URI}" ]; then
echo "NEXT_PUBLIC_API_URI is not set. Exiting..."
exit 1
fi

if [ -z "${AWS_REGION}" ]; then
echo "AWS_REGION is not set. Exiting..."
if [ -z "${NEXT_PUBLIC_AWS_REGION}" ]; then
echo "NEXT_PUBLIC_AWS_REGION is not set. Exiting..."
exit 1
fi

Expand All @@ -19,8 +20,8 @@ for dir in "/app/packages/dashboard/public" "/app/packages/dashboard/.next"; do
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"
sed -i "s|PLUNK_API_URI|${NEXT_PUBLIC_API_URI}|g" "$file"
sed -i "s|PLUNK_AWS_REGION|${NEXT_PUBLIC_AWS_REGION}|g" "$file"
echo "Processed: $file"
fi
done
Expand Down