fs: Add --disable flag to disable optional features - fixes #1551

Eg to disable server side copy use `--disable copy`, to see a list of
what you can disable, `--disable help`.
This commit is contained in:
Nick Craig-Wood
2017-08-07 21:10:03 +01:00
parent bced73c947
commit ec2ea37ad2
5 changed files with 132 additions and 5 deletions

View File

@@ -100,6 +100,7 @@ var (
tpsLimit = Float64P("tpslimit", "", 0, "Limit HTTP transactions per second to this.")
tpsLimitBurst = IntP("tpslimit-burst", "", 1, "Max burst of transactions for --tpslimit.")
bindAddr = StringP("bind", "", "", "Local address to bind to for outgoing connections, IPv4, IPv6 or name.")
disableFeatures = StringP("disable", "", "", "Disable a comma separated list of features. Use help to see a list.")
logLevel = LogLevelNotice
statsLogLevel = LogLevelInfo
bwLimit BwTimetable
@@ -235,6 +236,7 @@ type ConfigInfo struct {
TPSLimit float64
TPSLimitBurst int
BindAddr net.IP
DisableFeatures []string
}
// Return the path to the configuration file
@@ -410,6 +412,13 @@ func LoadConfig() {
Config.BindAddr = addrs[0]
}
if *disableFeatures != "" {
if *disableFeatures == "help" {
log.Fatalf("Possible backend features are: %s\n", strings.Join(new(Features).List(), ", "))
}
Config.DisableFeatures = strings.Split(*disableFeatures, ",")
}
// Load configuration file.
var err error
ConfigPath, err = filepath.Abs(*configFile)