-
Notifications
You must be signed in to change notification settings - Fork 617
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
Fabio can connect to Consul using TLS for secure communication. #391
Changes from all commits
b9d1c39
59dc220
33dd7cc
fb23d47
b813de4
467f4bd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,8 +19,23 @@ type be struct { | |
} | ||
|
||
func NewBackend(cfg *config.Consul) (registry.Backend, error) { | ||
|
||
var tls api.TLSConfig | ||
|
||
if cfg.EnableSSL { | ||
cfg.Scheme = "https" | ||
|
||
tls := &api.TLSConfig{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. tls variable is shadowed here. Here should be |
||
Address: cfg.Addr, | ||
CAFile: cfg.CAFile, | ||
CertFile: cfg.CertFile, | ||
KeyFile: cfg.KeyFile, | ||
} | ||
tls.InsecureSkipVerify = !cfg.VerifySSL | ||
} | ||
|
||
// create a reusable client | ||
c, err := api.NewClient(&api.Config{Address: cfg.Addr, Scheme: cfg.Scheme, Token: cfg.Token}) | ||
c, err := api.NewClient(&api.Config{Address: cfg.Addr, Scheme: cfg.Scheme, Token: cfg.Token, TLSConfig: tls}) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uppercase words are not parsed by flag library. If you change it to lower case flag will parse it correctly. I mean -
registry.consul.enableSSL
change toregistry.consul.enablessl
same for other added parametes