Files
zurg/internal/config/types.go
2023-11-07 17:20:54 +01:00

76 lines
1.7 KiB
Go

package config
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"`
}
func (z *ZurgConfig) GetToken() string {
return z.Token
}
func (z *ZurgConfig) GetHost() string {
if z.Host == "" {
return "[::]"
}
return z.Host
}
func (z *ZurgConfig) GetPort() string {
if z.Port == "" {
return "9999"
}
return z.Port
}
func (z *ZurgConfig) GetNumOfWorkers() int {
if z.NumOfWorkers == 0 {
return 10
}
return z.NumOfWorkers
}
func (z *ZurgConfig) GetRefreshEverySeconds() int {
if z.RefreshEverySeconds == 0 {
return 60
}
return z.RefreshEverySeconds
}
func (z *ZurgConfig) GetCacheTimeHours() int {
return z.CacheTimeHours
}
func (z *ZurgConfig) EnableRepair() bool {
return z.CanRepair
}
func (z *ZurgConfig) GetOnLibraryUpdate() string {
return z.OnLibraryUpdate
}
func (z *ZurgConfig) GetNetworkBufferSize() int {
if z.NetworkBufferSize == 0 {
return 32 * 1024
}
return z.NetworkBufferSize
}
func (z *ZurgConfig) GetMountPoint() string {
return z.MountPoint
}
func (z *ZurgConfig) EnableRetainFolderNameExtension() bool {
return z.RetainFolderNameExtension
}