source session secret from config file

This commit is contained in:
Brad Rydzewski 2015-04-08 16:36:56 -07:00
parent fad4fc64e6
commit c9edd1a018
2 changed files with 6 additions and 2 deletions

View file

@ -23,8 +23,12 @@ type session struct {
}
func New(s *settings.Session) Session {
secret := securecookie.GenerateRandomKey(32)
// TODO (bradrydzewski) hook up the Session.Expires
secret := s.Secret
expire := time.Hour * 72
if len(secret) == 0 {
securecookie.GenerateRandomKey(32)
}
return &session{
secret: secret,
expire: expire,

View file

@ -73,7 +73,7 @@ type Server struct {
// used to generate, validate and expire authentication
// sessions.
type Session struct {
Secret string `toml:"secret"`
Secret []byte `toml:"secret"`
Expires int64 `toml:"expires"`
}