3
3
4
4
echo -e " \e[34m[Info] Sourcebot version: $SOURCEBOT_VERSION \e[0m"
5
5
6
+ # If we don't have a PostHog key, then we need to disable telemetry.
7
+ if [ -z " $POSTHOG_PAPIK " ]; then
8
+ echo -e " \e[33m[Warning] POSTHOG_PAPIK was not set. Setting SOURCEBOT_TELEMETRY_DISABLED.\e[0m"
9
+ export SOURCEBOT_TELEMETRY_DISABLED=1
10
+ fi
11
+
6
12
# Issue a info message about telemetry
7
13
if [ ! -z " $SOURCEBOT_TELEMETRY_DISABLED " ]; then
8
14
echo -e " \e[34m[Info] Disabling telemetry since SOURCEBOT_TELEMETRY_DISABLED was set.\e[0m"
@@ -25,7 +31,7 @@ if [ ! -f "$FIRST_RUN_FILE" ]; then
25
31
# (if telemetry is enabled)
26
32
if [ -z " $SOURCEBOT_TELEMETRY_DISABLED " ]; then
27
33
curl -L -s --header " Content-Type: application/json" -d ' {
28
- "api_key": "' " $POSTHOG_KEY " ' ",
34
+ "api_key": "' " $POSTHOG_PAPIK " ' ",
29
35
"event": "install",
30
36
"distinct_id": "' " $SOURCEBOT_INSTALL_ID " ' ",
31
37
"properties": {
43
49
44
50
if [ -z " $SOURCEBOT_TELEMETRY_DISABLED " ]; then
45
51
curl -L -s --header " Content-Type: application/json" -d ' {
46
- "api_key": "' " $POSTHOG_KEY " ' ",
52
+ "api_key": "' " $POSTHOG_PAPIK " ' ",
47
53
"event": "upgrade",
48
54
"distinct_id": "' " $SOURCEBOT_INSTALL_ID " ' ",
49
55
"properties": {
@@ -83,12 +89,16 @@ echo -e "\e[34m[Info] Using config file at: '$CONFIG_PATH'.\e[0m"
83
89
export NEXT_PUBLIC_SOURCEBOT_VERSION=" $SOURCEBOT_VERSION "
84
90
fi
85
91
92
+ # Always infer NEXT_PUBLIC_POSTHOG_PAPIK
93
+ export NEXT_PUBLIC_POSTHOG_PAPIK=" $POSTHOG_PAPIK "
94
+
86
95
# Iterate over all .js files in .next & public, making substitutions for the `BAKED_` sentinal values
87
96
# with their actual desired runtime value.
88
97
find /app/packages/web/public /app/packages/web/.next -type f -name " *.js" |
89
98
while read file; do
90
99
sed -i " s|BAKED_NEXT_PUBLIC_SOURCEBOT_TELEMETRY_DISABLED|${NEXT_PUBLIC_SOURCEBOT_TELEMETRY_DISABLED} |g" " $file "
91
100
sed -i " s|BAKED_NEXT_PUBLIC_SOURCEBOT_VERSION|${NEXT_PUBLIC_SOURCEBOT_VERSION} |g" " $file "
101
+ sed -i " s|BAKED_NEXT_PUBLIC_POSTHOG_PAPIK|${NEXT_PUBLIC_POSTHOG_PAPIK} |g" " $file "
92
102
done
93
103
}
94
104
0 commit comments