2014-06-14 20:15:10 +04:00
|
|
|
package store
|
2014-06-13 22:36:36 +04:00
|
|
|
|
2014-06-14 20:15:10 +04:00
|
|
|
import (
|
|
|
|
"github.com/gorilla/sessions"
|
|
|
|
"github.com/yosssi/boltstore/shared"
|
|
|
|
)
|
2014-06-13 22:36:36 +04:00
|
|
|
|
|
|
|
// Config represents a config for a session store.
|
|
|
|
type Config struct {
|
2014-06-18 06:50:40 +04:00
|
|
|
// SessionOptions represents options for a session.
|
2014-06-13 22:36:36 +04:00
|
|
|
SessionOptions sessions.Options
|
2014-06-18 06:50:40 +04:00
|
|
|
// DBOptions represents options for a database.
|
|
|
|
DBOptions Options
|
2014-06-13 22:36:36 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// setDefault sets default to the config.
|
|
|
|
func (c *Config) setDefault() {
|
|
|
|
if c.SessionOptions.Path == "" {
|
2014-06-14 20:15:10 +04:00
|
|
|
c.SessionOptions.Path = shared.DefaultPath
|
2014-06-13 22:36:36 +04:00
|
|
|
}
|
2014-06-17 12:53:24 +04:00
|
|
|
if c.SessionOptions.MaxAge == 0 {
|
|
|
|
c.SessionOptions.MaxAge = shared.DefaultMaxAge
|
|
|
|
}
|
2014-06-13 22:36:36 +04:00
|
|
|
if c.DBOptions.BucketName == nil {
|
2014-06-14 20:15:10 +04:00
|
|
|
c.DBOptions.BucketName = []byte(shared.DefaultBucketName)
|
2014-06-13 22:36:36 +04:00
|
|
|
}
|
|
|
|
}
|