-
Notifications
You must be signed in to change notification settings - Fork 2.9k
/
Copy pathoptions.go
40 lines (32 loc) · 888 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
39
40
package nsqlookupd
import (
"log"
"os"
"time"
"github.com/nsqio/nsq/internal/lg"
)
type Options struct {
LogLevel lg.LogLevel `flag:"log-level"`
LogPrefix string `flag:"log-prefix"`
Logger Logger
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"`
}
func NewOptions() *Options {
hostname, err := os.Hostname()
if err != nil {
log.Fatal(err)
}
return &Options{
LogPrefix: "[nsqlookupd] ",
LogLevel: lg.INFO,
TCPAddress: "0.0.0.0:4160",
HTTPAddress: "0.0.0.0:4161",
BroadcastAddress: hostname,
InactiveProducerTimeout: 300 * time.Second,
TombstoneLifetime: 45 * time.Second,
}
}