Skip to content

Commit

Permalink
feat: ability to specify cli flags via env variables
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickjahns committed Apr 28, 2020
1 parent 74bffcb commit c53f24c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/command/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,34 +48,40 @@ func Run() error {
Aliases: []string{"web.listen-address"},
Value: "0.0.0.0:9176",
Usage: "Address to bind the metrics server",
EnvVars: []string{"OPENVPN_EXPORTER_WEB_ADDRESS"},
Destination: &cfg.Server.Addr,
},
&cli.StringFlag{
Name: "web.path",
Aliases: []string{"web.telemetry-path"},
Value: "/metrics",
Usage: "Path to bind the metrics server",
EnvVars: []string{"OPENVPN_EXPORTER_WEB_PATH"},
Destination: &cfg.Server.Path,
},
&cli.StringFlag{
Name: "web.root",
Value: "/",
Usage: "Root path to exporter endpoints",
EnvVars: []string{"OPENVPN_EXPORTER_WEB_ROOT"},
Destination: &cfg.Server.Root,
},
&cli.StringSliceFlag{
Name: "status-file",
Usage: "The OpenVPN status file(s) to export (example test:./example/version1.status )",
EnvVars: []string{"OPENVPN_EXPORTER_STATUS_FILE"},
Required: true,
},
&cli.BoolFlag{
Name: "disable-client-metrics",
Usage: "Disables per client (bytes_received, bytes_sent, connected_since) metrics",
EnvVars: []string{"OPENVPN_EXPORTER_DISABLE_CLIENT_METRICS"},
},
&cli.BoolFlag{
Name: "enable-golang-metrics",
Value: false,
Usage: "Enables golang and process metrics for the exporter) ",
EnvVars: []string{"OPENVPN_EXPORTER_ENABLE_GOLANG_METRICS"},
Destination: &cfg.ExportGoMetrics,
},
}
Expand Down

0 comments on commit c53f24c

Please sign in to comment.