Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add hostname-override flag to root command to support overriding SNI hostname #309

Merged
merged 1 commit into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions internal/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,5 +108,10 @@ func DialOptsFromFlags(cmd *cobra.Command, token storage.Token) ([]grpc.DialOpti
opts = append(opts, certOpt)
}

hostnameOverride := cobrautil.MustGetString(cmd, "hostname-override")
if hostnameOverride != "" {
opts = append(opts, grpc.WithAuthority(hostnameOverride))
}

return opts, nil
}
1 change: 1 addition & 0 deletions internal/cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ func Run() {

rootCmd.PersistentFlags().String("endpoint", "", "spicedb gRPC API endpoint")
rootCmd.PersistentFlags().String("permissions-system", "", "permissions system to query")
rootCmd.PersistentFlags().String("hostname-override", "", "override the hostname used in the connection to the endpoint")
rootCmd.PersistentFlags().String("token", "", "token used to authenticate to SpiceDB")
rootCmd.PersistentFlags().String("certificate-path", "", "path to certificate authority used to verify secure connections")
rootCmd.PersistentFlags().Bool("insecure", false, "connect over a plaintext connection")
Expand Down
Loading