forked from BasedHardware/omi
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate-public-client-env.sh
More file actions
executable file
·40 lines (35 loc) · 1010 Bytes
/
Copy pathcreate-public-client-env.sh
File metadata and controls
executable file
·40 lines (35 loc) · 1010 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env bash
set -euo pipefail
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
OUT="${1:-$ROOT/app/.client.env}"
TMP="$(mktemp "${TMPDIR:-/tmp}/omi-public-client-env.XXXXXX")"
trap 'rm -f "$TMP"' EXIT
umask 077
emit() {
local name="$1"
local value="${!name:-}"
if [ -n "$value" ]; then
case "$value" in
*$'\n'*|*$'\r'*)
echo "ERROR: $name contains a newline and cannot be written to $OUT" >&2
exit 1
;;
esac
printf '%s=%s\n' "$name" "$value" >> "$TMP"
fi
}
# Every value emitted here is compiled into public client binaries.
emit PUBLIC_API_BASE_URL
emit PUBLIC_STAGING_API_URL
emit PUBLIC_USE_WEB_AUTH
emit PUBLIC_USE_AUTH_CUSTOM_TOKEN
emit PUBLIC_GOOGLE_MAPS_API_KEY
emit PUBLIC_GOOGLE_CLIENT_ID
emit PUBLIC_POSTHOG_API_KEY
emit PUBLIC_INTERCOM_APP_ID
emit PUBLIC_INTERCOM_IOS_API_KEY
emit PUBLIC_INTERCOM_ANDROID_API_KEY
python3 "$ROOT/scripts/check-public-client-secrets.py" --env-file "$TMP"
mkdir -p "$(dirname "$OUT")"
mv "$TMP" "$OUT"
trap - EXIT