mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-05 23:26:38 +08:00
wavelet init
This commit is contained in:
Executable
+39
@@ -0,0 +1,39 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
replace_placeholder() {
|
||||
local placeholder="$1"
|
||||
local real_value="$2"
|
||||
|
||||
if [ -z "$real_value" ]; then
|
||||
echo "⚠️ WARNING: Environment variable for placeholder '${placeholder}' is not set. Skipping replacement."
|
||||
return 0
|
||||
fi
|
||||
|
||||
echo "🔍 Replacing placeholder '${placeholder}' with value '${real_value}'"
|
||||
|
||||
local escaped
|
||||
escaped=$(printf '%s\n' "$real_value" | sed 's/[&/\]/\\&/g')
|
||||
|
||||
local files
|
||||
if [ -f /app/.replace.files ]; then
|
||||
files=$(grep -l "$placeholder" $(cat /app/.replace.files) 2>/dev/null || true)
|
||||
fi
|
||||
|
||||
if [ -z "$files" ]; then
|
||||
echo "⚠️ WARNING: placeholder '${placeholder}' not found in any file"
|
||||
else
|
||||
local count
|
||||
count=$(echo "$files" | wc -l)
|
||||
echo "$files" | xargs sed -i "s|${placeholder}|${escaped}|g"
|
||||
echo "✅ Replaced '${placeholder}' in ${count} file(s)"
|
||||
fi
|
||||
}
|
||||
|
||||
replace_placeholder "https://build-placeholder.invalid" "$NEXT_PUBLIC_WAVELET_BACKEND_URL"
|
||||
replace_placeholder "https://build-placeholder-2.invalid" "$WAVELET_BACKEND_URL"
|
||||
replace_placeholder "__WAVELET_SESSION_COOKIE_NAME__" "$WAVELET_SESSION_COOKIE_NAME"
|
||||
replace_placeholder "__WAVELET_RATE_LIMIT_ENABLED__" "$WAVELET_RATE_LIMIT_ENABLED"
|
||||
|
||||
exec "$@"
|
||||
Reference in New Issue
Block a user