fix: --host value passed to setup is written to generated config (#255)
This commit is contained in:
@ -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)
|
||||
|
||||
Reference in New Issue
Block a user