[add] configurable cookie attribute settings
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2023-10-24 18:41:25 -04:00
parent 912b054502
commit 3577dd89a0
3 changed files with 14 additions and 6 deletions

View File

@@ -11,8 +11,8 @@ type Config struct {
ListenPort string
// DB Configuration
DBType string
DBName string
DBType string
DBName string
// Data Paths
ConfigPath string
@@ -20,8 +20,12 @@ type Config struct {
// Miscellaneous Settings
RegistrationEnabled bool
CookieSessionKey string
SearchEnabled bool
// Cookie Settings
CookieSessionKey string
CookieSecure bool
CookieHTTPOnly bool
}
func Load() *Config {
@@ -32,9 +36,11 @@ func Load() *Config {
ConfigPath: getEnv("CONFIG_PATH", "/config"),
DataPath: getEnv("DATA_PATH", "/data"),
ListenPort: getEnv("LISTEN_PORT", "8585"),
CookieSessionKey: trimLowerString(getEnv("COOKIE_SESSION_KEY", "")),
RegistrationEnabled: trimLowerString(getEnv("REGISTRATION_ENABLED", "false")) == "true",
SearchEnabled: trimLowerString(getEnv("SEARCH_ENABLED", "false")) == "true",
CookieSessionKey: trimLowerString(getEnv("COOKIE_SESSION_KEY", "")),
CookieSecure: trimLowerString(getEnv("COOKIE_SECURE", "true")) == "true",
CookieHTTPOnly: trimLowerString(getEnv("COOKIE_HTTP_ONLY", "true")) == "true",
}
}