Skip to content

Commit

Permalink
feat: remove insecure token checks
Browse files Browse the repository at this point in the history
When a user specifies --insecure (most often to run locally), he should
be able to use the token that may be already locally stored (with the
recent introduction of local tokens) so we should not force the use to
write something like

`myctl cmd --insecure --token $(myctl auth print-identity-token)`

when the cli is already able to automatically supply the `--token` flag.
  • Loading branch information
alethenorio committed Oct 11, 2023
1 parent 2cbd552 commit 7eae6c3
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions aipcli/dial.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,10 @@ func dial(cmd *cobra.Command) (*grpc.ClientConn, error) {
}

func dialInsecure(cmd *cobra.Command) (*grpc.ClientConn, error) {
token, hasToken := getToken(cmd)
token, _ := getToken(cmd)
address, hasAddress := getAddress(cmd)
switch {
case !hasAddress:
if !hasAddress {
return nil, fmt.Errorf("must provide --address with --insecure")
case hasToken && !strings.HasPrefix(address, "localhost:"):
return nil, fmt.Errorf("must connect to localhost with --insecure and --token")
}
if IsVerbose(cmd) {
cmd.PrintErrln(">> insecure address:", address)
Expand Down

0 comments on commit 7eae6c3

Please sign in to comment.