forked from free-lancers/electricity_bill_calc_service
		
	feat(config):增加用户会话时长的配置项。
This commit is contained in:
		| @@ -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 | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user