tstor/config/model.go

38 lines
878 B
Go
Raw Normal View History

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"`
2021-03-01 18:04:59 +00:00
AllowOther bool `yaml:"fuse-allow-other,omitempty"`
MountPoints []*MountPoint `yaml:"mountPoints"`
2021-03-01 18:04:59 +00:00
WebDAV *WebDAV `yaml:"webDav"`
}
type WebDAV struct {
Torrents []*Torrent `yaml:"torrents"`
}
type MountPoint struct {
2021-03-01 18:04:59 +00:00
Path string `yaml:"path"`
Torrents []*Torrent `yaml:"torrents"`
}
type Torrent struct {
MagnetURI string `yaml:"magnetUri,omitempty"`
TorrentPath string `yaml:"torrentPath,omitempty"`
FolderName string `yaml:"folderName,omitempty"`
}
func AddDefaults(r *Root) *Root {
if r.MaxCacheSize == 0 {
r.MaxCacheSize = 1024 // 1GB
}
if r.MetadataFolder == "" {
r.MetadataFolder = "./distribyted-data/metadata"
}
return r
}