mirror of
https://github.com/wasp-lang/wasp.git
synced 2024-11-23 19:29:17 +03:00
Added very basic telemetry to installer script.
This commit is contained in:
parent
9489e9f247
commit
89300a9e0a
@ -32,6 +32,7 @@ done
|
||||
|
||||
main() {
|
||||
trap cleanup_temp_dir EXIT
|
||||
send_telemetry > /dev/null 2>&1 &
|
||||
install_based_on_os
|
||||
}
|
||||
|
||||
@ -48,6 +49,20 @@ install_based_on_os() {
|
||||
esac
|
||||
}
|
||||
|
||||
get_os_info() {
|
||||
case "$(uname)" in
|
||||
"Linux")
|
||||
echo "Linux"
|
||||
;;
|
||||
"Darwin")
|
||||
echo "Darwin"
|
||||
;;
|
||||
*)
|
||||
echo "Unknown"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# TODO: Add option to specify which release to download.
|
||||
|
||||
# Download a Wasp binary package and install it in $HOME_LOCAL_BIN.
|
||||
@ -205,4 +220,18 @@ on_path() {
|
||||
echo ":$PATH_NORMALIZED:" | grep -q ":$QUERY_NORMALIZED:"
|
||||
}
|
||||
|
||||
send_telemetry() {
|
||||
DATA='{ "api_key": "CdDd2A0jKTI2vFAsrI9JWm3MqpOcgHz1bMyogAcwsE4", "type": "capture", "event": "install-script:run", "distinct_id": "'$RANDOM`date +'%s%N'`'", "properties": { "os": "'`get_os_info`'" } }'
|
||||
URL="https://app.posthog.com/capture"
|
||||
HEADER="Content-Type: application/json"
|
||||
|
||||
if [ -z "$WASP_TELEMETRY_DISABLE" ]; then
|
||||
if has_curl; then
|
||||
curl -sfL -d "$DATA" --header "$HEADER" "$URL" > /dev/null 2>&1
|
||||
elif has_wget; then
|
||||
wget -q --post-data="$DATA" --header="$HEADER" "$URL" > /dev/null 2>&1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
main
|
||||
|
Loading…
Reference in New Issue
Block a user