-
Notifications
You must be signed in to change notification settings - Fork 0
/
options.go
38 lines (29 loc) · 856 Bytes
/
options.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
package nsqlookupd
import (
"log"
"os"
"time"
)
type nsqlookupdOptions struct {
Verbose bool `flag:"verbose"`
TCPAddress string `flag:"tcp-address"`
HTTPAddress string `flag:"http-address"`
BroadcastAddress string `flag:"broadcast-address"`
InactiveProducerTimeout time.Duration `flag:"inactive-producer-timeout"`
TombstoneLifetime time.Duration `flag:"tombstone-lifetime"`
Logger logger
}
func NewNSQLookupdOptions() *nsqlookupdOptions {
hostname, err := os.Hostname()
if err != nil {
log.Fatal(err)
}
return &nsqlookupdOptions{
TCPAddress: "0.0.0.0:4160",
HTTPAddress: "0.0.0.0:4161",
BroadcastAddress: hostname,
InactiveProducerTimeout: 300 * time.Second,
TombstoneLifetime: 45 * time.Second,
Logger: log.New(os.Stderr, "[nsqlookupd] ", log.Ldate|log.Ltime|log.Lmicroseconds),
}
}