/
config.go
28 lines (23 loc) · 1.11 KB
/
config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package http
const (
defaultBytesPerSecond = 100 * 1024 * 1024
)
// Config specifies the configuration for the zfs http server
type Config struct {
HTTPPathPrefix string `json:"HTTPPathPrefix" yaml:"HTTPPathPrefix"`
ParentDataset string `json:"ParentDataset" yaml:"ParentDataset"`
SpeedBytesPerSecond int64 `json:"SpeedBytesPerSecond" yaml:"SpeedBytesPerSecond"`
Permissions Permissions `json:"Permissions" yaml:"Permissions"`
}
// Permissions specifies permissions for requests over zfs http
type Permissions struct {
AllowSpeedOverride bool `json:"AllowSpeedOverride" yaml:"AllowSpeedOverride"`
AllowNonRaw bool `json:"AllowNonRaw" yaml:"AllowNonRaw"`
AllowIncludeProperties bool `json:"AllowIncludeProperties" yaml:"AllowIncludeProperties"`
AllowDestroyFilesystems bool `json:"AllowDestroyFilesystems" yaml:"AllowDestroyFilesystems"`
AllowDestroySnapshots bool `json:"AllowDestroySnapshots" yaml:"AllowDestroySnapshots"`
}
// ApplyDefaults sets all config values to their defaults (if they have one)
func (c *Config) ApplyDefaults() {
c.SpeedBytesPerSecond = defaultBytesPerSecond
}