File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- NEXT_PUBLIC_POSTHOG_KEY = phc_VFn4CkEGHRdlVyOOw8mfkoj1DKVoG6y1007EClvzAnS
21NEXT_PUBLIC_POSTHOG_HOST = https://us.i.posthog.com
32NEXT_PUBLIC_POSTHOG_ASSET_HOST = https://us-assets.i.posthog.com
4- NEXT_PUBLIC_POSTHOG_UI_HOST = https://us.posthog.com
3+ NEXT_PUBLIC_POSTHOG_UI_HOST = https://us.posthog.com
4+
5+ # @note: This is also set in the Dockerfile.
6+ NEXT_PUBLIC_POSTHOG_KEY = phc_VFn4CkEGHRdlVyOOw8mfkoj1DKVoG6y1007EClvzAnS
Original file line number Diff line number Diff line change @@ -35,11 +35,14 @@ ENV DATA_DIR=/data
3535ENV CONFIG_PATH=$DATA_DIR/config.json
3636ENV DATA_CACHE_DIR=$DATA_DIR/.sourcebot
3737
38+ # @note: This is also set in .env
39+ ENV NEXT_PUBLIC_POSTHOG_KEY=phc_VFn4CkEGHRdlVyOOw8mfkoj1DKVoG6y1007EClvzAnS
40+
3841# Sourcebot collects anonymous usage data using [PostHog](https://posthog.com/). Uncomment this line to disable.
3942# ENV SOURCEBOT_TELEMETRY_DISABLED=1
4043
4144# Configure dependencies
42- RUN apk add --no-cache git ca-certificates bind-tools tini jansson wget supervisor
45+ RUN apk add --no-cache git ca-certificates bind-tools tini jansson wget supervisor uuidgen curl
4346
4447# Configure zoekt
4548COPY vendor/zoekt/install-ctags-alpine.sh .
Original file line number Diff line number Diff line change 11#! /bin/sh
22set -e
33
4+ # Issue a info message about telemetry
5+ if [ ! -z " $SOURCEBOT_TELEMETRY_DISABLED " ]; then
6+ echo -e " \e[34m[Info] Disabling telemetry since SOURCEBOT_TELEMETRY_DISABLED was set.\e[0m"
7+ fi
8+
9+ # Check if DATA_CACHE_DIR exists, if not create it
10+ if [ ! -d " $DATA_CACHE_DIR " ]; then
11+ mkdir -p " $DATA_CACHE_DIR "
12+ fi
13+
14+ # In order to detect if this is the first run, we create a `.installed` file in
15+ # the cache directory.
16+ FIRST_RUN_FILE=" $DATA_CACHE_DIR /.installed"
17+ if [ ! -f " $FIRST_RUN_FILE " ]; then
18+ touch " $FIRST_RUN_FILE "
19+
20+ # If this is our first run, send a `install` event to PostHog
21+ # (if telemetry is enabled)
22+ if [ -z " $SOURCEBOT_TELEMETRY_DISABLED " ]; then
23+ curl -L -s --header " Content-Type: application/json" -d ' {
24+ "api_key": "' " $NEXT_PUBLIC_POSTHOG_KEY " ' ",
25+ "event": "install",
26+ "distinct_id": "' " $( uuidgen) " ' "
27+ }' https://us.i.posthog.com/capture/ > /dev/null
28+ fi
29+ fi
30+
431# Fallback to sample config if a config does not exist
532if [ ! -f " $CONFIG_PATH " ]; then
633 echo -e " \e[33m[Warning] Config file at CONFIG_PATH not found. Falling back on sample config.\e[0m"
You can’t perform that action at this time.
0 commit comments