options.go 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. package nsqadmin
  2. import (
  3. "time"
  4. "github.com/nsqio/nsq/internal/lg"
  5. )
  6. type Options struct {
  7. LogLevel lg.LogLevel `flag:"log-level"`
  8. LogPrefix string `flag:"log-prefix"`
  9. Logger Logger
  10. HTTPAddress string `flag:"http-address"`
  11. BasePath string `flag:"base-path"`
  12. DevStaticDir string `flag:"dev-static-dir"`
  13. GraphiteURL string `flag:"graphite-url"`
  14. ProxyGraphite bool `flag:"proxy-graphite"`
  15. StatsdPrefix string `flag:"statsd-prefix"`
  16. StatsdCounterFormat string `flag:"statsd-counter-format"`
  17. StatsdGaugeFormat string `flag:"statsd-gauge-format"`
  18. StatsdInterval time.Duration `flag:"statsd-interval"`
  19. NSQLookupdHTTPAddresses []string `flag:"lookupd-http-address" cfg:"nsqlookupd_http_addresses"`
  20. NSQDHTTPAddresses []string `flag:"nsqd-http-address" cfg:"nsqd_http_addresses"`
  21. HTTPClientConnectTimeout time.Duration `flag:"http-client-connect-timeout"`
  22. HTTPClientRequestTimeout time.Duration `flag:"http-client-request-timeout"`
  23. HTTPClientTLSInsecureSkipVerify bool `flag:"http-client-tls-insecure-skip-verify"`
  24. HTTPClientTLSRootCAFile string `flag:"http-client-tls-root-ca-file"`
  25. HTTPClientTLSCert string `flag:"http-client-tls-cert"`
  26. HTTPClientTLSKey string `flag:"http-client-tls-key"`
  27. AllowConfigFromCIDR string `flag:"allow-config-from-cidr"`
  28. NotificationHTTPEndpoint string `flag:"notification-http-endpoint"`
  29. AclHttpHeader string `flag:"acl-http-header"`
  30. AdminUsers []string `flag:"admin-user" cfg:"admin_users"`
  31. }
  32. func NewOptions() *Options {
  33. return &Options{
  34. LogPrefix: "[smqadmin] ",
  35. LogLevel: lg.INFO,
  36. HTTPAddress: "0.0.0.0:9071",
  37. BasePath: "/",
  38. StatsdPrefix: "nsq.%s",
  39. StatsdCounterFormat: "stats.counters.%s.count",
  40. StatsdGaugeFormat: "stats.gauges.%s",
  41. StatsdInterval: 60 * time.Second,
  42. HTTPClientConnectTimeout: 2 * time.Second,
  43. HTTPClientRequestTimeout: 5 * time.Second,
  44. AllowConfigFromCIDR: "127.0.0.1/8",
  45. AclHttpHeader: "X-Forwarded-User",
  46. AdminUsers: []string{},
  47. }
  48. }