Skip to content

Commit

Permalink
fix: rename flag to secure (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
spy16 authored Feb 20, 2023
1 parent f704a80 commit 0f62fe6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
22 changes: 14 additions & 8 deletions cli/cdk/dex_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type swaggerParams interface {
}

type swaggerTransport struct {
runtime.ClientTransport
*httptransport.Runtime

Context context.Context
Timeout time.Duration
Expand All @@ -36,7 +36,13 @@ func (tr *swaggerTransport) Submit(operation *runtime.ClientOperation) (interfac
}
params.SetContext(tr.Context)
}
return tr.ClientTransport.Submit(operation)

v, err := tr.Runtime.Submit(operation)
if err != nil {
return nil, err
}

return v, nil
}

func NewClient(cmd *cobra.Command) *client.DexAPI {
Expand All @@ -51,8 +57,8 @@ func NewClient(cmd *cobra.Command) *client.DexAPI {
}

scheme := []string{"http"}
if cfg.UseHTTPS {
scheme = append(scheme, "https")
if cfg.Secure {
scheme = []string{"https"}
}

r := httptransport.New(cfg.Host, "/api", scheme)
Expand All @@ -65,15 +71,15 @@ func NewClient(cmd *cobra.Command) *client.DexAPI {
return client.New(customTr, strfmt.Default)
}

func newSwaggerTransport(cmd *cobra.Command, r runtime.ClientTransport) *swaggerTransport {
func newSwaggerTransport(cmd *cobra.Command, r *httptransport.Runtime) *swaggerTransport {
d, err := cmd.Flags().GetDuration("timeout")
if err != nil || d == 0 {
d = 10 * time.Second
}

return &swaggerTransport{
ClientTransport: r,
Context: cmd.Context(),
Timeout: d,
Runtime: r,
Context: cmd.Context(),
Timeout: d,
}
}
4 changes: 2 additions & 2 deletions cli/config/configs.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ var ErrClientConfigNotFound = errors.New(heredoc.Doc(`
`))

type ClientConfig struct {
Host string `yaml:"host" cmdx:"host"`
UseHTTPS bool `yaml:"use_https" cmdx:"use_https"`
Host string `yaml:"host" cmdx:"host"`
Secure bool `yaml:"secure" cmdx:"secure"`
}

func Load() (*ClientConfig, error) {
Expand Down

0 comments on commit 0f62fe6

Please sign in to comment.