storj/cmd/uplink/initial_setup.go
JT Olio d632f23950 cmd/uplink: add eventkit
Change-Id: If109c8f7de257b77794e45599487ad2c46f2c3ec
2022-10-07 12:08:08 -04:00

36 lines
888 B
Go

// Copyright (C) 2021 Storj Labs, Inc.
// See LICENSE for copying information.
package main
import (
"context"
"strings"
"github.com/zeebo/errs"
"storj.io/storj/cmd/uplink/ulext"
)
func saveInitialConfig(ctx context.Context, ex ulext.External) error {
answer, err := ex.PromptInput(ctx, `With your permission, Storj can `+
`automatically collect analytics information from your uplink CLI to `+
`help improve the quality and performance of our products. This `+
`information is sent only with your consent and is submitted `+
`anonymously to Storj Labs: (y/n)`)
if err != nil {
return errs.Wrap(err)
}
answer = strings.ToLower(answer)
values := make(map[string]string)
if answer != "y" && answer != "yes" {
values["metrics.addr"] = ""
values["analytics.enabled"] = "false"
} else {
values["analytics.enabled"] = "true"
}
return ex.SaveConfig(values)
}