Add configs
This commit is contained in:
@@ -20,6 +20,8 @@ type ConfigInterface interface {
|
||||
GetRandomPreferredHost() string
|
||||
ShouldServeFromRclone() bool
|
||||
ShouldForceIPv6() bool
|
||||
GetUnrestrictWorkers() int
|
||||
GetReleaseUnrestrictAfterMs() int
|
||||
}
|
||||
|
||||
type ZurgConfig struct {
|
||||
@@ -28,6 +30,8 @@ type ZurgConfig struct {
|
||||
Host string `yaml:"host"`
|
||||
Port string `yaml:"port"`
|
||||
NumOfWorkers int `yaml:"concurrent_workers"`
|
||||
UnrestrictWorkers int `yaml:"unrestrict_workers"`
|
||||
ReleaseUnrestrictAfterMs int `yaml:"release_unrestrict_after_ms"`
|
||||
RefreshEverySeconds int `yaml:"check_for_changes_every_secs"`
|
||||
CanRepair bool `yaml:"enable_repair"`
|
||||
OnLibraryUpdate string `yaml:"on_library_update"`
|
||||
@@ -60,7 +64,7 @@ func (z *ZurgConfig) GetPort() string {
|
||||
|
||||
func (z *ZurgConfig) GetNumOfWorkers() int {
|
||||
if z.NumOfWorkers == 0 {
|
||||
return 10
|
||||
return 50
|
||||
}
|
||||
return z.NumOfWorkers
|
||||
}
|
||||
@@ -117,3 +121,17 @@ func (z *ZurgConfig) ShouldServeFromRclone() bool {
|
||||
func (z *ZurgConfig) ShouldForceIPv6() bool {
|
||||
return z.ForceIPv6
|
||||
}
|
||||
|
||||
func (z *ZurgConfig) GetUnrestrictWorkers() int {
|
||||
if z.UnrestrictWorkers == 0 {
|
||||
return 20
|
||||
}
|
||||
return z.UnrestrictWorkers
|
||||
}
|
||||
|
||||
func (z *ZurgConfig) GetReleaseUnrestrictAfterMs() int {
|
||||
if z.ReleaseUnrestrictAfterMs == 0 {
|
||||
return 100
|
||||
}
|
||||
return z.ReleaseUnrestrictAfterMs
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user