Skip to content

Commit

Permalink
override config by default
Browse files Browse the repository at this point in the history
  • Loading branch information
roblaszczak committed Feb 28, 2024
1 parent 6f8cbe4 commit d8625fb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
3 changes: 2 additions & 1 deletion tdl/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ var app = &cli.App{
&cli.BoolFlag{
Name: "override",
Usage: "if config already exists, it will be overridden",
// deprecated, backward compatibility
Hidden: true,
},
},
Action: func(c *cli.Context) error {
Expand All @@ -117,7 +119,6 @@ var app = &cli.App{
token,
c.String("server"),
c.String("region"),
c.Bool("override"),
c.Bool("insecure"),
)
},
Expand Down
6 changes: 1 addition & 5 deletions trainings/configure.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@ import (
"github.com/ThreeDotsLabs/cli/trainings/genproto"
)

func (h *Handlers) ConfigureGlobally(ctx context.Context, token, serverAddr, region string, override, insecure bool) error {
if !override && h.config.ConfiguredGlobally() {
return errors.New("trainings are already configured. Please pass --override flag to configure again")
}

func (h *Handlers) ConfigureGlobally(ctx context.Context, token, serverAddr, region string, insecure bool) error {
if region != "" {
if region != "eu" && region != "us" {
return errors.New("region can be only eu or us")
Expand Down

0 comments on commit d8625fb

Please sign in to comment.