storj/cmd/uplinkng/initial_setup.go
Jeff Wendling d57583dfd4 cmd/uplinkng: initial setup
Change-Id: If4df3ec8b3b554f5228d43e97503eb8a87525b23
2021-08-19 17:48:49 +00:00

33 lines
816 B
Go

// Copyright (C) 2021 Storj Labs, Inc.
// See LICENSE for copying information.
package main
import (
"strings"
"github.com/zeebo/clingy"
"github.com/zeebo/errs"
"storj.io/storj/cmd/uplinkng/ulext"
)
func saveInitialConfig(ctx clingy.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"] = ""
}
return ex.SaveConfig(values)
}