mirror of
https://github.com/muety/wakapi.git
synced 2023-08-10 21:12:56 +03:00
fix: minor fix for key generation
This commit is contained in:
parent
6c75bb5d21
commit
b1dff58025
@ -396,18 +396,18 @@ func Load(version string) *Config {
|
|||||||
config.App.Colors = readColors()
|
config.App.Colors = readColors()
|
||||||
config.Db.Dialect = resolveDbDialect(config.Db.Type)
|
config.Db.Dialect = resolveDbDialect(config.Db.Type)
|
||||||
|
|
||||||
var hashKey []byte
|
hashKey := securecookie.GenerateRandomKey(64)
|
||||||
var blockKey []byte
|
blockKey := securecookie.GenerateRandomKey(32)
|
||||||
|
sessionKey := securecookie.GenerateRandomKey(32)
|
||||||
|
|
||||||
if IsDev(env) {
|
if IsDev(env) {
|
||||||
logbuch.Warn("using temporary keys to sign and encrypt cookies in dev mode, make sure to set env to production for real-world use")
|
logbuch.Warn("using temporary keys to sign and encrypt cookies in dev mode, make sure to set env to production for real-world use")
|
||||||
hashKey, blockKey = getTemporarySecureKeys()
|
hashKey, blockKey = getTemporarySecureKeys()
|
||||||
} else {
|
blockKey = hashKey
|
||||||
hashKey = securecookie.GenerateRandomKey(64)
|
|
||||||
blockKey = securecookie.GenerateRandomKey(64)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
config.Security.SecureCookie = securecookie.New(hashKey, blockKey)
|
config.Security.SecureCookie = securecookie.New(hashKey, blockKey)
|
||||||
config.Security.SessionKey = securecookie.GenerateRandomKey(32)
|
config.Security.SessionKey = sessionKey
|
||||||
|
|
||||||
if strings.HasSuffix(config.Server.BasePath, "/") {
|
if strings.HasSuffix(config.Server.BasePath, "/") {
|
||||||
config.Server.BasePath = config.Server.BasePath[:len(config.Server.BasePath)-1]
|
config.Server.BasePath = config.Server.BasePath[:len(config.Server.BasePath)-1]
|
||||||
|
Loading…
Reference in New Issue
Block a user