From 20b28cfbd32343c37cb9e0b4aca1cee7de24fb9b Mon Sep 17 00:00:00 2001 From: Jaime Pillora Date: Sun, 2 Oct 2016 21:34:57 +1100 Subject: [PATCH] set on exit default to 'ignore' (instead of implementing special validate command) --- agent/config.go | 14 +++++++------- default.toml | 6 +----- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/agent/config.go b/agent/config.go index f397fb4..ee40638 100644 --- a/agent/config.go +++ b/agent/config.go @@ -20,11 +20,12 @@ const ( LogWebUI = "webui" LogProxy = "proxy" - OnExitRestart = "restart" - OnExitIgnore = "ignore" - OnExitProxy = "proxy" + OnExitRestart OnExit = "restart" + OnExitIgnore = "ignore" + OnExitProxy = "proxy" ) +//Config is shared for both toml unmarshalling and opts CLI generation type Config struct { Host string `help:"listening interface"` Port int `help:"listening port" env:"PORT"` @@ -33,10 +34,9 @@ type Config struct { AllowedIPs []string `opts:"-"` ProgramArgs []string `type:"arglist" min:"1" name:"args" help:"args can be either a command with arguments or a webproc file"` Log Log `opts:"-"` - OnExit OnExit `help:"process exit action" default:"proxy"` + OnExit OnExit `help:"process exit action" default:"ignore"` ConfigurationFiles []string `name:"config" type:"commalist" help:"comma-separated list of configuration files"` - // VerifyProgramArgs []string `name:"verify" type:"spacelist" help:"command used to verify configuration"` - RestartTimeout Duration `opts:"-"` + RestartTimeout Duration `opts:"-"` } func LoadConfig(path string, c *Config) error { @@ -77,7 +77,7 @@ func ValidateConfig(c *Config) error { switch c.OnExit { case OnExitProxy, OnExitIgnore, OnExitRestart: default: - c.OnExit = OnExitProxy + c.OnExit = OnExitIgnore } if c.RestartTimeout == 0 { c.RestartTimeout = Duration(30 * time.Second) diff --git a/default.toml b/default.toml index d573d72..b2f9a51 100644 --- a/default.toml +++ b/default.toml @@ -27,16 +27,12 @@ Log = "both" # "ignore" - ignore and wait for manual restart via the web UI # "restart" - automatically restart with exponential backoff time delay between failed restarts # It is recommended to use "proxy" and then to run webproc commands via a process manager. -OnExit = "proxy" +OnExit = "ignore" # Configuration files to be editable by the web UI. # For example, dnsmasq would include "/etc/dnsmasq.conf" ConfigurationFiles = [] -# TODO When provided, this command will be used verify all configuration changes -# before restarting the process. An exit code 0 means valid, otherwise it's assumed invalid. -# VerifyProgramArgs = [] - # After the restart signal (SIGINT) has been sent, webproc will wait for RestartTimeout before # forcibly restarting the process (SIGKILL). RestartTimeout = "30s"