outposts/proxy: use filesystem storage for non-embedded outposts
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
2ddf122d27
commit
4e2457560d
|
@ -2,6 +2,7 @@ package application
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/gorilla/sessions"
|
"github.com/gorilla/sessions"
|
||||||
|
@ -26,14 +27,14 @@ func (a *Application) getStore(p api.ProxyOutpostConfig) sessions.Store {
|
||||||
a.log.Info("using redis session backend")
|
a.log.Info("using redis session backend")
|
||||||
store = rs
|
store = rs
|
||||||
} else {
|
} else {
|
||||||
cs := sessions.NewCookieStore([]byte(*p.CookieSecret))
|
cs := sessions.NewFilesystemStore(os.TempDir(), []byte(*p.CookieSecret))
|
||||||
cs.Options.Domain = *p.CookieDomain
|
cs.Options.Domain = *p.CookieDomain
|
||||||
if p.TokenValidity.IsSet() {
|
if p.TokenValidity.IsSet() {
|
||||||
t := p.TokenValidity.Get()
|
t := p.TokenValidity.Get()
|
||||||
// Add one to the validity to ensure we don't have a session with indefinite length
|
// Add one to the validity to ensure we don't have a session with indefinite length
|
||||||
cs.Options.MaxAge = int(*t) + 1
|
cs.Options.MaxAge = int(*t) + 1
|
||||||
}
|
}
|
||||||
a.log.Info("using cookie session backend")
|
a.log.Info("using filesystem session backend")
|
||||||
store = cs
|
store = cs
|
||||||
}
|
}
|
||||||
return store
|
return store
|
||||||
|
|
Reference in New Issue