feat(config):增加用户会话时长的配置项。
This commit is contained in:
parent
7d34fd1b6d
commit
6a8daf77d2
|
@ -29,11 +29,16 @@ type RedisSetting struct {
|
|||
DB int
|
||||
}
|
||||
|
||||
type ServiceSetting struct {
|
||||
MaxSessionLife time.Duration
|
||||
}
|
||||
|
||||
//定义全局变量
|
||||
var (
|
||||
ServerSettings *ServerSetting
|
||||
DatabaseSettings *DatabaseSetting
|
||||
RedisSettings *RedisSetting
|
||||
ServiceSettings *ServiceSetting
|
||||
)
|
||||
|
||||
//读取配置到全局变量
|
||||
|
@ -56,5 +61,10 @@ func SetupSetting() error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = s.ReadSection("Service", &ServiceSettings)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -16,3 +16,5 @@ Redis:
|
|||
Port: 6379
|
||||
Password:
|
||||
DB: 2
|
||||
Service:
|
||||
MaxSessionLife: 2h
|
Loading…
Reference in New Issue
Block a user