Skip to content

Commit 7eae6c3

Browse files
committed
feat: remove insecure token checks
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.
1 parent 2cbd552 commit 7eae6c3

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

aipcli/dial.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,10 @@ func dial(cmd *cobra.Command) (*grpc.ClientConn, error) {
8989
}
9090

9191
func dialInsecure(cmd *cobra.Command) (*grpc.ClientConn, error) {
92-
token, hasToken := getToken(cmd)
92+
token, _ := getToken(cmd)
9393
address, hasAddress := getAddress(cmd)
94-
switch {
95-
case !hasAddress:
94+
if !hasAddress {
9695
return nil, fmt.Errorf("must provide --address with --insecure")
97-
case hasToken && !strings.HasPrefix(address, "localhost:"):
98-
return nil, fmt.Errorf("must connect to localhost with --insecure and --token")
9996
}
10097
if IsVerbose(cmd) {
10198
cmd.PrintErrln(">> insecure address:", address)

0 commit comments

Comments
 (0)