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