fix(fe/be): clean up and enable quota in ui

This commit is contained in:
hexxa 2021-08-08 17:58:16 +08:00 committed by Hexxa
parent cdd15be4aa
commit f986015c0b
11 changed files with 41 additions and 159 deletions

View file

@ -23,6 +23,8 @@ type UsersCfg struct {
UploadSpeedLimit int `json:"uploadSpeedLimit" yaml:"uploadSpeedLimit"`
DownloadSpeedLimit int `json:"downloadSpeedLimit" yaml:"downloadSpeedLimit"`
SpaceLimit int `json:"spaceLimit" yaml:"spaceLimit"`
LimiterCapacity int `json:"limiterCapacity" yaml:"limiterCapacity"`
LimiterCyc int `json:"limiterCyc" yaml:"limiterCyc"`
}
type Secrets struct {
@ -72,6 +74,8 @@ func DefaultConfig() (string, error) {
UploadSpeedLimit: 100 * 1024, // B
DownloadSpeedLimit: 100 * 1024, // B
SpaceLimit: 1024, // GB
LimiterCapacity: 1000,
LimiterCyc: 1000, // 1s
},
Secrets: &Secrets{
TokenSecret: "",

View file

@ -105,8 +105,8 @@ func initDeps(cfg gocfg.ICfg) *depidx.Deps {
panic(fmt.Sprintf("fail to init user store: %s", err))
}
limiterCap := cfg.IntOr("Users.LimiterCapacity", 4096)
limiterCyc := cfg.IntOr("Users.LimiterCyc", 3000)
limiterCap := cfg.IntOr("Users.LimiterCapacity", 10000)
limiterCyc := cfg.IntOr("Users.LimiterCyc", 1000)
limiter := iolimiter.NewIOLimiter(limiterCap, limiterCyc, users)
deps := depidx.NewDeps(cfg)