mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-09-29 05:56:38 +08:00
63cd906cfc
- Merge all files inside openflare-server to the repository root directory. - Relocate agent, relay, and flared subprojects from internal/ to internal/apps/. - Combine docker-compose files and update build context paths to root. - Update GitHub workflows and Dockerfiles to refer to new directories and package names. - Rewrite Go package imports across all files. - Resolve database renew test race condition and clean up docs.
40 lines
1.2 KiB
Bash
Executable File
40 lines
1.2 KiB
Bash
Executable File
#!/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 "$@"
|