root: don't set signal on start when running in ci or dev

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-11-04 14:32:21 +01:00
parent 9ac3b29418
commit 8d766efecb
2 changed files with 20 additions and 14 deletions

View file

@ -432,6 +432,8 @@ if _ERROR_REPORTING:
env=CONFIG.y("error_reporting.environment", "customer"),
)
if not CONFIG.y_bool("disable_startup_analytics", False):
should_send = env not in ["dev", "ci"]
if should_send:
get_http_session().post(
"https://goauthentik.io/api/event",
json={

View file

@ -44,6 +44,10 @@ func analytics(akURL url.URL, on string) {
if _, s := os.LookupEnv("AUTHENTIK_DISABLE_ANALYTICS"); s {
return
}
e := getEnv()
if e == "ci" {
return
}
body := struct {
Domain string `json:"domain"`
Name string `json:"name"`
@ -52,7 +56,7 @@ func analytics(akURL url.URL, on string) {
}{
Domain: "authentik",
Name: "pageview",
URL: fmt.Sprintf("http://localhost/outpost/%s", getEnv()),
URL: fmt.Sprintf("http://localhost/outpost/%s", e),
Referrer: fmt.Sprintf("%s (%s)", constants.VERSION, constants.BUILD()),
}
b, err := json.Marshal(body)