forked from nsqio/nsq
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoptions.go
61 lines (47 loc) · 2.05 KB
/
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package nsqadmin
import (
"time"
"github.com/nsqio/nsq/internal/lg"
)
type Options struct {
LogLevel lg.LogLevel `flag:"log-level"`
LogPrefix string `flag:"log-prefix"`
Logger Logger
HTTPAddress string `flag:"http-address"`
BasePath string `flag:"base-path"`
GraphiteURL string `flag:"graphite-url"`
ProxyGraphite bool `flag:"proxy-graphite"`
StatsdPrefix string `flag:"statsd-prefix"`
StatsdCounterFormat string `flag:"statsd-counter-format"`
StatsdGaugeFormat string `flag:"statsd-gauge-format"`
StatsdInterval time.Duration `flag:"statsd-interval"`
NSQLookupdHTTPAddresses []string `flag:"lookupd-http-address" cfg:"nsqlookupd_http_addresses"`
NSQDHTTPAddresses []string `flag:"nsqd-http-address" cfg:"nsqd_http_addresses"`
HTTPClientConnectTimeout time.Duration `flag:"http-client-connect-timeout"`
HTTPClientRequestTimeout time.Duration `flag:"http-client-request-timeout"`
HTTPClientTLSInsecureSkipVerify bool `flag:"http-client-tls-insecure-skip-verify"`
HTTPClientTLSRootCAFile string `flag:"http-client-tls-root-ca-file"`
HTTPClientTLSCert string `flag:"http-client-tls-cert"`
HTTPClientTLSKey string `flag:"http-client-tls-key"`
AllowConfigFromCIDR string `flag:"allow-config-from-cidr"`
NotificationHTTPEndpoint string `flag:"notification-http-endpoint"`
AclHttpHeader string `flag:"acl-http-header"`
AdminUsers []string `flag:"admin-user" cfg:"admin_users"`
}
func NewOptions() *Options {
return &Options{
LogPrefix: "[nsqadmin] ",
LogLevel: lg.INFO,
HTTPAddress: "0.0.0.0:4171",
BasePath: "/",
StatsdPrefix: "nsq.%s",
StatsdCounterFormat: "stats.counters.%s.count",
StatsdGaugeFormat: "stats.gauges.%s",
StatsdInterval: 60 * time.Second,
HTTPClientConnectTimeout: 2 * time.Second,
HTTPClientRequestTimeout: 5 * time.Second,
AllowConfigFromCIDR: "127.0.0.1/8",
AclHttpHeader: "X-Forwarded-User",
AdminUsers: []string{},
}
}