diff --git a/src/config/service.go b/src/config/service.go index 2d27690..6264e81 100644 --- a/src/config/service.go +++ b/src/config/service.go @@ -9,16 +9,16 @@ import ( type ServiceConfig struct { Port int `env:"PORT" json:"port"` SecuredPort int `env:"SECURED_PORT" json:"securedPort"` - SSLEnabled bool `env:"SSL_ENABLED" envDefault:"false" json:"sslEnabled"` + TLSEnabled bool `env:"TLS_ENABLED" envDefault:"false" json:"tlsEnabled"` TLSCertPath string `env:"TLS_CERT_PATH" json:"tlsCertPath"` TLSKeyPath string `env:"TLS_KEY_PATH" json:"tlsKeyPath"` tlsCert tls.Certificate } -// LoadCerts attempts to load CA & TLS certificates defined in configuration +// LoadCerts attempts to load TLS certificates defined in configuration func (c *ServiceConfig) LoadCerts() error { - if !c.SSLEnabled { + if !c.TLSEnabled { return nil } @@ -34,7 +34,7 @@ func (c *ServiceConfig) LoadCerts() error { // GetTLSConfig returns the *tls.Config based on given configuration func (c *ServiceConfig) GetTLSConfig() *tls.Config { - if !c.SSLEnabled { + if !c.TLSEnabled { return nil } diff --git a/src/config/service_test.go b/src/config/service_test.go index 3010322..5f4cb26 100644 --- a/src/config/service_test.go +++ b/src/config/service_test.go @@ -126,7 +126,7 @@ func TestLoadCerts(t *testing.T) { genFunc func(*testing.T) (string, string) errorExpected bool }{ - "SSL disabled": { + "TLS disabled": { sslEnabled: false, genFunc: noopCertGen, errorExpected: false, @@ -147,7 +147,7 @@ func TestLoadCerts(t *testing.T) { name, tc := name, tc t.Run(name, func(t *testing.T) { conf := &config.ServiceConfig{ - SSLEnabled: tc.sslEnabled, + TLSEnabled: tc.sslEnabled, } conf.TLSCertPath, conf.TLSKeyPath = tc.genFunc(t) @@ -173,7 +173,7 @@ func TestGetTLSConfig(t *testing.T) { name, tc := name, tc t.Run(name, func(t *testing.T) { conf := &config.ServiceConfig{ - SSLEnabled: tc.sslEnabled, + TLSEnabled: tc.sslEnabled, } actual := conf.GetTLSConfig() diff --git a/src/services/admin/service.go b/src/services/admin/service.go index cd96902..d6c0443 100644 --- a/src/services/admin/service.go +++ b/src/services/admin/service.go @@ -93,7 +93,7 @@ func (s *AdminAPIService) buildServers() (*http.Server, *http.Server) { s.log.Debug().Dict("ports", zerolog.Dict(). Int("plain", s.cfg.Port). Int("secured", s.cfg.SecuredPort), - ).Bool("sslEnabled", s.cfg.SSLEnabled).Msg("building servers") + ).Bool("sslEnabled", s.cfg.TLSEnabled).Msg("building servers") plainServer := &http.Server{ Addr: fmt.Sprintf(":%d", s.cfg.Port), @@ -101,7 +101,7 @@ func (s *AdminAPIService) buildServers() (*http.Server, *http.Server) { } var securedServer *http.Server - if s.cfg.SSLEnabled { + if s.cfg.TLSEnabled { securedServer = &http.Server{ Addr: fmt.Sprintf(":%d", s.cfg.SecuredPort), TLSConfig: s.cfg.GetTLSConfig(), diff --git a/src/services/content/service.go b/src/services/content/service.go index c707bbd..b7e5723 100644 --- a/src/services/content/service.go +++ b/src/services/content/service.go @@ -72,7 +72,7 @@ func (s *ContentService) buildServers() (*http.Server, *http.Server) { s.log.Debug().Dict("ports", zerolog.Dict(). Int("plain", s.cfg.Port). Int("secured", s.cfg.SecuredPort), - ).Bool("sslEnabled", s.cfg.SSLEnabled).Msg("building servers") + ).Bool("sslEnabled", s.cfg.TLSEnabled).Msg("building servers") plainServer := &http.Server{ Addr: fmt.Sprintf(":%d", s.cfg.Port), @@ -80,7 +80,7 @@ func (s *ContentService) buildServers() (*http.Server, *http.Server) { } var securedServer *http.Server - if s.cfg.SSLEnabled { + if s.cfg.TLSEnabled { securedServer = &http.Server{ Addr: fmt.Sprintf(":%d", s.cfg.SecuredPort), TLSConfig: s.cfg.GetTLSConfig(),