-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.go
64 lines (58 loc) · 1.77 KB
/
types.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*
* Copyright (c) 2016-2017, Randy Westlund. All rights reserved.
* This code is under the BSD-2-Clause license.
*
* This file contains struct definitions.
*/
package main
import (
"time"
)
// The status object returned from launching a child in a goroutine.
type launchStatus struct {
Name string
Pid int
// If the process failed for any reason, that reason is here.
Err error
// The duration for which the process ran.
Duration time.Duration
}
type process struct {
// The process config object from the config file.
Config processConfig
// The most recent launch status.
Status launchStatus
// Whether it's currently running or not.
Running bool
}
// A process definition, as read directly from the config file.
type processConfig struct {
// A human-readable tag for process.
Name string
// The path to the actual executable to run.
Path string
// An array of string arguments to be passed to the process.
Args []string
// The cwd of the process. Defaults to /var/empty.
Cwd string
// Filenames for writing stdout and stderr. Defaults to /dev/null.
Stdout string
Stderr string
// The number of milliseconds to wait before restarting a process.
RestartDelay uint64 `toml:"restart_delay"`
// Whether to disable restarting on failure.
IgnoreFailure bool `toml:"ignore_failure"`
// If a process exits within this many milliseconds, don't restart it. A
// value of 0 disables this check.
MinRuntime int `toml:"min_runtime"`
SoftDepends []string `toml:"soft_depends"`
User string
Group string
}
// The config file definition.
type configOptions struct {
// This must be named after the [[process]] block in the config file.
Process []processConfig
// Where to send paladin's logging output. Defaults to stderr.
LogFile string `toml:"log_file"`
}