tstor/torrent/config/model.go
Antonio Navarro Perez ecd524ed3c First functional web interface version.
- Simplify by now all html and javascript.
- Added a simple interface using go templates and plain javascript.
- Improved REST interface for the use case.
- Changed some properties into the config file to make it suitable for
future use cases.

Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
2020-05-18 19:42:23 +02:00

29 lines
653 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"`
Torrents []struct {
MagnetURI string `yaml:"magnetUri"`
TorrentPath string `yaml:"torrentPath"`
FolderName string `yaml:"folderName,omitempty"`
} `yaml:"torrents"`
}
func AddDefaults(r *Root) *Root {
if r.MaxCacheSize == 0 {
r.MaxCacheSize = 1024 // 1GB
}
if r.MetadataFolder == "" {
r.MetadataFolder = "./metadata"
}
return r
}