Skip to content

Commit

Permalink
chore(auth): remove redundant default config creation
Browse files Browse the repository at this point in the history
  • Loading branch information
pinglin committed Oct 13, 2023
1 parent 3f27ea4 commit 6d8856c
Showing 1 changed file with 0 additions and 15 deletions.
15 changes: 0 additions & 15 deletions pkg/cmd/auth/login/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,9 @@ import (
"github.com/MakeNowJust/heredoc"
"github.com/spf13/cobra"

"github.com/instill-ai/cli/internal/build"
"github.com/instill-ai/cli/internal/config"
"github.com/instill-ai/cli/internal/instance"
"github.com/instill-ai/cli/internal/oauth2"
"github.com/instill-ai/cli/pkg/cmd/factory"
"github.com/instill-ai/cli/pkg/cmd/local"
"github.com/instill-ai/cli/pkg/cmdutil"
"github.com/instill-ai/cli/pkg/iostreams"
Expand Down Expand Up @@ -93,34 +91,21 @@ func loginRun(f *cmdutil.Factory, opts *LoginOptions) error {
if err != nil {
return err
}

cmdFactory := factory.New(build.Version)
stderr := cmdFactory.IOStreams.ErrOut
cs := cmdFactory.IOStreams.ColorScheme()

fmt.Fprintln(stderr, cs.Bold("No hosts.yml config, creating one with the default host \"api.instill.tech\"..."))
fmt.Fprintln(stderr, config.HostsConfigFile())
fmt.Fprintln(stderr, "")
} else {

hostname := opts.Hostname

hosts, err := cfg.HostsTyped()
if err != nil {
return err
}

for _, h := range hosts {
if h.APIHostname == hostname {
host = &h
break
}
}

if host == nil {
return fmt.Errorf("ERROR: instance '%s' does not exists", hostname)
}

}

// TODO INS-1659 drop in favor of OAuth2
Expand Down

0 comments on commit 6d8856c

Please sign in to comment.