Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to set bind address at startup #186

Merged
merged 1 commit into from
Mar 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config/loader_flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ package config
func LoadConfigFromFlags(config *Config, flags *StartupFlags) error {
config.Listen = ListenConfig{
Port: flags.ListenPort,
Address: "0.0.0.0",
Address: flags.ListenAddress,
MetricsEndpoint: flags.MetricsEndpoint,
}
config.Namespaces = []NamespaceConfig{
Expand Down
1 change: 1 addition & 0 deletions config/structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ type StartupFlags struct {
Parser string
Format string
Namespace string
ListenAddress string
ListenPort int
EnableExperimentalFeatures bool
MetricsEndpoint string
Expand Down
1 change: 1 addition & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ func main() {
nsGatherers := make(prometheus.Gatherers, 0)

flag.IntVar(&opts.ListenPort, "listen-port", 4040, "HTTP port to listen on")
flag.StringVar(&opts.ListenAddress, "listen-address", "0.0.0.0", "IP-address to bind")
flag.StringVar(&opts.Parser, "parser", "text", "NGINX access log format parser. One of: [text, json]")
flag.StringVar(&opts.Format, "format", `$remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" "$http_x_forwarded_for"`, "NGINX access log format")
flag.StringVar(&opts.Namespace, "namespace", "nginx", "namespace to use for metric names")
Expand Down