mirror of
https://github.com/kataras/iris.git
synced 2025-03-13 21:36:28 +01:00
Align with the latest go-sessions
This commit is contained in:
parent
787425e5c5
commit
7ea334812f
|
@ -310,6 +310,11 @@ func DefaultConfiguration() Configuration {
|
|||
// sixth is the DisableSubdomainPersistence which you can set it to true in order dissallow your q subdomains to have access to the session cook
|
||||
type SessionsConfiguration sessions.Config
|
||||
|
||||
// Set implements the OptionSetter of the sessions package
|
||||
func (s SessionsConfiguration) Set(c *sessions.Config) {
|
||||
*c = sessions.Config(s).Validate()
|
||||
}
|
||||
|
||||
var (
|
||||
// OptionSessionsCookie string, the session's client cookie name, for example: "qsessionid"
|
||||
OptionSessionsCookie = func(val string) OptionSet {
|
||||
|
@ -388,6 +393,7 @@ func DefaultSessionsConfiguration() SessionsConfiguration {
|
|||
Expires: 0,
|
||||
GcDuration: DefaultSessionGcDuration,
|
||||
DisableSubdomainPersistence: false,
|
||||
DisableAutoGC: true,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
13
iris.go
13
iris.go
|
@ -217,9 +217,12 @@ func New(setters ...OptionSetter) *Framework {
|
|||
})
|
||||
}
|
||||
|
||||
// websocket
|
||||
// websocket & sessions
|
||||
{
|
||||
s.Websocket = NewWebsocketServer() // in order to be able to call $instance.Websocket.OnConnection
|
||||
|
||||
// set the sessions, look .initialize for its GC
|
||||
s.sessions = sessions.New(sessions.DisableAutoGC(true))
|
||||
}
|
||||
|
||||
// routing & http server
|
||||
|
@ -236,9 +239,6 @@ func New(setters ...OptionSetter) *Framework {
|
|||
s.Available = make(chan bool)
|
||||
}
|
||||
|
||||
// set empty sessions , look .initialize for its Init
|
||||
s.sessions = sessions.Empty()
|
||||
|
||||
return s
|
||||
}
|
||||
|
||||
|
@ -268,7 +268,7 @@ func (s *Framework) initialize() {
|
|||
|
||||
s.templates.Reload = s.Config.IsDevelopment
|
||||
// check and prepare the templates
|
||||
if len(s.templates.Entries) == 0 { // no template engine is registered, let's use the default
|
||||
if len(s.templates.Entries) == 0 { // no template engines were registered, let's use the default
|
||||
s.UseTemplate(html.New())
|
||||
}
|
||||
|
||||
|
@ -279,7 +279,8 @@ func (s *Framework) initialize() {
|
|||
|
||||
// init, starts the session manager if the Cookie configuration field is not empty
|
||||
if s.Config.Sessions.Cookie != "" {
|
||||
s.sessions.Init(sessions.Config(s.Config.Sessions))
|
||||
// re-set the configuration field for any case
|
||||
s.sessions.Set(s.Config.Sessions, sessions.DisableAutoGC(false))
|
||||
}
|
||||
|
||||
if s.Config.Websocket.Endpoint != "" {
|
||||
|
|
Loading…
Reference in New Issue
Block a user