mirror of
https://github.com/harness/drone.git
synced 2025-05-21 19:39:59 +08:00
source session secret from config file
This commit is contained in:
parent
fad4fc64e6
commit
c9edd1a018
@ -23,8 +23,12 @@ type session struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func New(s *settings.Session) Session {
|
func New(s *settings.Session) Session {
|
||||||
secret := securecookie.GenerateRandomKey(32)
|
// TODO (bradrydzewski) hook up the Session.Expires
|
||||||
|
secret := s.Secret
|
||||||
expire := time.Hour * 72
|
expire := time.Hour * 72
|
||||||
|
if len(secret) == 0 {
|
||||||
|
securecookie.GenerateRandomKey(32)
|
||||||
|
}
|
||||||
return &session{
|
return &session{
|
||||||
secret: secret,
|
secret: secret,
|
||||||
expire: expire,
|
expire: expire,
|
||||||
|
@ -73,7 +73,7 @@ type Server struct {
|
|||||||
// used to generate, validate and expire authentication
|
// used to generate, validate and expire authentication
|
||||||
// sessions.
|
// sessions.
|
||||||
type Session struct {
|
type Session struct {
|
||||||
Secret string `toml:"secret"`
|
Secret []byte `toml:"secret"`
|
||||||
Expires int64 `toml:"expires"`
|
Expires int64 `toml:"expires"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user