feat(config):增加用户会话时长的配置项。

This commit is contained in:
徐涛 2022-08-09 16:04:23 +08:00
parent 7d34fd1b6d
commit 6a8daf77d2
2 changed files with 12 additions and 0 deletions

View File

@ -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
}

View File

@ -16,3 +16,5 @@ Redis:
Port: 6379
Password:
DB: 2
Service:
MaxSessionLife: 2h