2020-04-27 16:46:23 +00:00
|
|
|
package config
|
|
|
|
|
|
|
|
// Root is the main yaml config object
|
|
|
|
type Root struct {
|
|
|
|
MaxCacheSize int64 `yaml:"max-cache-size,omitempty"`
|
|
|
|
MetadataFolder string `yaml:"metadata-folder-name,omitempty"`
|
|
|
|
|
|
|
|
MountPoints []*MountPoint `yaml:"mountPoints"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type MountPoint struct {
|
2020-05-18 17:42:23 +00:00
|
|
|
Path string `yaml:"path"`
|
|
|
|
Torrents []struct {
|
2020-11-08 17:19:25 +00:00
|
|
|
MagnetURI string `yaml:"magnetUri,omitempty"`
|
|
|
|
TorrentPath string `yaml:"torrentPath,omitempty"`
|
2020-05-18 17:42:23 +00:00
|
|
|
FolderName string `yaml:"folderName,omitempty"`
|
|
|
|
} `yaml:"torrents"`
|
2020-04-27 16:46:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func AddDefaults(r *Root) *Root {
|
|
|
|
if r.MaxCacheSize == 0 {
|
|
|
|
r.MaxCacheSize = 1024 // 1GB
|
|
|
|
}
|
|
|
|
if r.MetadataFolder == "" {
|
2020-11-08 17:19:25 +00:00
|
|
|
r.MetadataFolder = "./distribyted-data/metadata"
|
2020-04-27 16:46:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return r
|
|
|
|
}
|