Compare commits

...

2 Commits

Author SHA1 Message Date
Stavros
e8d2e059a9 fix: pass cookie expiry to api config 2025-01-25 20:00:07 +02:00
Stavros
2c7a3fc801 refactor: simplify cookie secure logic 2025-01-25 16:29:18 +02:00
2 changed files with 3 additions and 10 deletions

View File

@@ -94,6 +94,7 @@ var rootCmd = &cobra.Command{
AppURL: config.AppURL,
CookieSecure: config.CookieSecure,
DisableContinue: config.DisableContinue,
CookieExpiry: config.CookieExpiry,
}, hooks, auth, providers)
// Setup routes

View File

@@ -55,20 +55,12 @@ func (api *API) Init() {
domain, domainErr := utils.GetRootURL(api.Config.AppURL)
log.Info().Str("domain", domain).Msg("Using domain for cookies")
if domainErr != nil {
log.Fatal().Err(domainErr).Msg("Failed to get domain")
os.Exit(1)
}
var isSecure bool
if api.Config.CookieSecure {
isSecure = true
} else {
isSecure = false
}
log.Info().Str("domain", domain).Msg("Using domain for cookies")
api.Domain = fmt.Sprintf(".%s", domain)
@@ -76,7 +68,7 @@ func (api *API) Init() {
Domain: api.Domain,
Path: "/",
HttpOnly: true,
Secure: isSecure,
Secure: api.Config.CookieSecure,
MaxAge: api.Config.CookieExpiry,
})