mirror of
https://github.com/luxfi/safe-wallet.git
synced 2026-10-30 15:19:21 +00:00
It enumerated asset directories, so it offered brands with no env file and stopped after the first one under set -e. It reads the env files it needs instead.
47 lines
1.3 KiB
Bash
Executable File
47 lines
1.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# select-brand.sh — switch the active brand for a local build.
|
|
#
|
|
# Usage: scripts/select-brand.sh <slug> (any apps/web/.env.<slug>)
|
|
#
|
|
# Copies apps/web/.env.<slug> -> apps/web/.env.local (overridden each run).
|
|
#
|
|
# Nothing else is baked in: name, logo, icons and manifest are served from
|
|
# apps/web/public/brand/<slug>/ and picked by request host at runtime.
|
|
#
|
|
# After this runs, `yarn workspace @safe-global/web build` produces the branded build.
|
|
|
|
set -euo pipefail
|
|
|
|
slug="${1:-}"
|
|
|
|
if [[ -z "$slug" ]]; then
|
|
echo "usage: scripts/select-brand.sh <slug>"
|
|
echo "available brands:"
|
|
for f in apps/web/.env.*; do
|
|
name="${f##*/.env.}"
|
|
if [[ "$name" != "example" && "$name" != "local" ]]; then
|
|
echo " - $name"
|
|
fi
|
|
done
|
|
exit 1
|
|
fi
|
|
|
|
repo_root="$(cd "$(dirname "$0")/.." && pwd)"
|
|
env_file="$repo_root/apps/web/.env.$slug"
|
|
brand_dir="$repo_root/apps/web/public/brand/$slug"
|
|
|
|
if [[ ! -f "$env_file" ]]; then
|
|
echo "error: $env_file not found"
|
|
exit 2
|
|
fi
|
|
if [[ ! -d "$brand_dir" ]]; then
|
|
echo "error: $brand_dir not found"
|
|
exit 2
|
|
fi
|
|
|
|
cp "$env_file" "$repo_root/apps/web/.env.local"
|
|
|
|
echo "brand '$slug' selected"
|
|
echo " env -> apps/web/.env.local"
|
|
echo " assets -> apps/web/public/brand/$slug/ (served as-is, resolved by host)"
|