fixes here and there
This commit is contained in:
@@ -1,18 +1,21 @@
|
||||
package config
|
||||
|
||||
import "math/rand"
|
||||
|
||||
type ZurgConfig struct {
|
||||
Version string `yaml:"zurg"`
|
||||
Token string `yaml:"token"`
|
||||
Host string `yaml:"host"`
|
||||
Port string `yaml:"port"`
|
||||
NumOfWorkers int `yaml:"concurrent_workers"`
|
||||
RefreshEverySeconds int `yaml:"check_for_changes_every_secs"`
|
||||
CacheTimeHours int `yaml:"info_cache_time_hours"`
|
||||
CanRepair bool `yaml:"enable_repair"`
|
||||
OnLibraryUpdate string `yaml:"on_library_update"`
|
||||
NetworkBufferSize int `yaml:"network_buffer_size"`
|
||||
MountPoint string `yaml:"mount_point"`
|
||||
RetainFolderNameExtension bool `yaml:"retain_folder_name_extension"`
|
||||
Version string `yaml:"zurg"`
|
||||
Token string `yaml:"token"`
|
||||
Host string `yaml:"host"`
|
||||
Port string `yaml:"port"`
|
||||
NumOfWorkers int `yaml:"concurrent_workers"`
|
||||
RefreshEverySeconds int `yaml:"check_for_changes_every_secs"`
|
||||
CacheTimeHours int `yaml:"info_cache_time_hours"`
|
||||
CanRepair bool `yaml:"enable_repair"`
|
||||
OnLibraryUpdate string `yaml:"on_library_update"`
|
||||
NetworkBufferSize int `yaml:"network_buffer_size"`
|
||||
MountPoint string `yaml:"mount_point"`
|
||||
RetainFolderNameExtension bool `yaml:"retain_folder_name_extension"`
|
||||
PreferredHosts []string `yaml:"preferred_hosts"`
|
||||
}
|
||||
|
||||
func (z *ZurgConfig) GetToken() string {
|
||||
@@ -73,3 +76,11 @@ func (z *ZurgConfig) GetMountPoint() string {
|
||||
func (z *ZurgConfig) EnableRetainFolderNameExtension() bool {
|
||||
return z.RetainFolderNameExtension
|
||||
}
|
||||
|
||||
func (z *ZurgConfig) GetRandomPreferredHost() string {
|
||||
if len(z.PreferredHosts) == 0 {
|
||||
return ""
|
||||
}
|
||||
randomIndex := rand.Intn(len(z.PreferredHosts))
|
||||
return z.PreferredHosts[randomIndex]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user