diff --git a/app/echoSettings.go b/app/echoSettings.go index 89122aa..93a5b1b 100644 --- a/app/echoSettings.go +++ b/app/echoSettings.go @@ -72,7 +72,7 @@ func (a *App) SetEchoSettings() { encrSecret []byte ) - if a.setting.SessionAuthIsHex { + if a.setting.SessionAuthIsHex() { b, err := hex.DecodeString(a.setting.SessionCookieAuthSecret()) if err != nil { panic(err) @@ -81,7 +81,7 @@ func (a *App) SetEchoSettings() { authSecret = b } - if a.setting.SessionEncrIsHex { + if a.setting.SessionEncrIsHex() { b, err := hex.DecodeString(a.setting.SessionCookieEncrSecret()) if err != nil { panic(err) diff --git a/app/settings/settings.go b/app/settings/settings.go index 2278592..02b7dcb 100644 --- a/app/settings/settings.go +++ b/app/settings/settings.go @@ -29,8 +29,8 @@ type Settings struct { sessionCookieName string sessionCookieAuthSecret string sessionCookieEncrSecret string - SessionAuthIsHex bool - SessionEncrIsHex bool + sessionAuthIsHex bool + sessionEncrIsHex bool assetsPath string templatesPath string version string @@ -87,11 +87,11 @@ func (s *Settings) Consolidate(conf *config.Config, host *string, port *int, dev authHex, encrHex := conf.SessionSecretsAreHex() if authHex { - s.SessionAuthIsHex = true + s.sessionAuthIsHex = true } if encrHex { - s.SessionEncrIsHex = true + s.sessionEncrIsHex = true } if conf.HTTP.Gzip > 0 { @@ -204,6 +204,16 @@ func (s *Settings) SessionCookieEncrSecret() string { return s.sessionCookieEncrSecret } +// SessionAuthIsHex returns whether the session cookie authentication secret is hex. +func (s *Settings) SessionAuthIsHex() bool { + return s.sessionAuthIsHex +} + +// SessionEncrIsHex returns whether the session cookie encryption secret is hex. +func (s *Settings) SessionEncrIsHex() bool { + return s.sessionEncrIsHex +} + // HTTPDomain returns the httpDomain. func (s *Settings) HTTPDomain() string { return s.httpDomain