tstor/torrent/config/model.go
Antonio Navarro Perez 657caea2d3 Add first working torrent implementation
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
2020-04-27 18:46:23 +02:00

28 lines
600 B
Go

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 {
Path string `yaml:"path"`
Magnets []struct {
URI string `yaml:"uri"`
FolderName string `yaml:"folderName,omitempty"`
} `yaml:"magnets"`
}
func AddDefaults(r *Root) *Root {
if r.MaxCacheSize == 0 {
r.MaxCacheSize = 1024 // 1GB
}
if r.MetadataFolder == "" {
r.MetadataFolder = "./metadata"
}
return r
}