-
Notifications
You must be signed in to change notification settings - Fork 2
/
starter.go
52 lines (39 loc) · 1.32 KB
/
starter.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
package dewy
import (
"os"
"time"
starter "github.com/lestrrat-go/server-starter"
)
// StarterConfig struct.
type StarterConfig struct {
args []string
command string
dir string
interval int
pidfile string
ports []string
paths []string
sigonhup string
sigonterm string
statusfile string
}
// Args for StarterConfig.
func (c StarterConfig) Args() []string { return c.args }
// Command for StarterConfig.
func (c StarterConfig) Command() string { return c.command }
// Dir for StarterConfig.
func (c StarterConfig) Dir() string { return c.dir }
// Interval for StarterConfig.
func (c StarterConfig) Interval() time.Duration { return time.Duration(c.interval) * time.Second }
// PidFile for StarterConfig.
func (c StarterConfig) PidFile() string { return c.pidfile }
// Ports for StarterConfig.
func (c StarterConfig) Ports() []string { return c.ports }
// Paths for StarterConfig.
func (c StarterConfig) Paths() []string { return c.paths }
// SignalOnHUP for StarterConfig.
func (c StarterConfig) SignalOnHUP() os.Signal { return starter.SigFromName(c.sigonhup) }
// SignalOnTERM for StarterConfig.
func (c StarterConfig) SignalOnTERM() os.Signal { return starter.SigFromName(c.sigonterm) }
// StatusFile for StarterConfig.
func (c StarterConfig) StatusFile() string { return c.statusfile }