Skip to content

Commit

Permalink
set on exit default to 'ignore' (instead of implementing special vali…
Browse files Browse the repository at this point in the history
…date command)
  • Loading branch information
jpillora committed Oct 2, 2016
1 parent 3d661ed commit 20b28cf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
14 changes: 7 additions & 7 deletions agent/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand All @@ -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 {
Expand Down Expand Up @@ -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)
Expand Down
6 changes: 1 addition & 5 deletions default.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

0 comments on commit 20b28cf

Please sign in to comment.