fix: --host value passed to setup is written to generated config (#255)

This commit is contained in:
Daniel Moran
2021-09-02 17:42:37 -04:00
committed by GitHub
parent 38040fa8dc
commit 65da55e3f3
4 changed files with 79 additions and 12 deletions

View File

@ -36,6 +36,7 @@ type Params struct {
Retention string
Force bool
ConfigName string
Host string
}
func (c Client) Setup(ctx context.Context, params *Params) error {
@ -66,13 +67,16 @@ func (c Client) Setup(ctx context.Context, params *Params) error {
cfg := config.Config{
Name: config.DefaultConfig.Name,
Host: c.ActiveConfig.Host,
Host: config.DefaultConfig.Host,
Token: *resp.Auth.Token,
Org: resp.Org.Name,
}
if params.ConfigName != "" {
cfg.Name = params.ConfigName
}
if params.Host != "" {
cfg.Host = params.Host
}
if _, err := c.ConfigService.CreateConfig(cfg); err != nil {
return fmt.Errorf("setup succeeded, but failed to write new config to local path: %w", err)