Skip to content

Commit

Permalink
add ability to specify x509 server name in http module
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexandarY authored and tcolgate committed Nov 16, 2023
1 parent 61f1fff commit a692f41
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ type httpConfig struct {
TLSKeyFile *string `yaml:"tls_key_file"` // no default
TLSCACertFile *string `yaml:"tls_ca_cert_file"` // no default
TLSRootCaFile *string `yaml:"tls_root_ca_file"` // no default
TLSServerName *string `yaml:"server_name"` // no default
Port int `yaml:"port"` // no default
Path string `yaml:"path"` // /metrics
Scheme string `yaml:"scheme"` // http
Expand Down Expand Up @@ -215,6 +216,9 @@ func (c httpConfig) getTLSConfig() (*tls.Config, error) {

config.RootCAs = systemCAPool
}
if c.TLSServerName != nil {
config.ServerName = *c.TLSServerName
}
if c.TLSCertFile != nil && c.TLSKeyFile != nil {
cert, err := tls.LoadX509KeyPair(*c.TLSCertFile, *c.TLSKeyFile)
if err != nil {
Expand Down

0 comments on commit a692f41

Please sign in to comment.