Skip to content

Commit

Permalink
Merge pull request #5 from maxpospelov/master
Browse files Browse the repository at this point in the history
Add Disable SSL and Force Path Style options.
  • Loading branch information
ribbybibby authored Aug 16, 2019
2 parents 83b59d6 + 20147fd commit fdf2ad7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ docker run -p 9340:9340 -e AWS_SDK_LOAD_CONFIG=true -e HOME=/ -v $HOME/.aws:/.aw
* __`--web.metrics-path`:__ The path metrics are exposed under (default "/metrics")
* __`--web.probe-path`:__ The path the probe endpoint is exposed under (default "/probe")
* __`--s3.endpoint-url`:__ A [custom endpoint URL](https://docs.aws.amazon.com/general/latest/gr/rande.html) (optional)
* __`--s3.disable-ssl`:__ Disable SSL (default "false")
* __`--s3.force-path-style`:__ Force path style (default "false")

Flags can also be set as environment variables, prefixed by `S3_EXPORTER_`. For example: `S3_EXPORTER_S3_ENDPOINT_URL=http://s3.example.local`.

Expand Down
15 changes: 10 additions & 5 deletions s3_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,13 @@ func init() {

func main() {
var (
app = kingpin.New(namespace+"_exporter", "Export metrics for S3 certificates").DefaultEnvars()
listenAddress = app.Flag("web.listen-address", "Address to listen on for web interface and telemetry.").Default(":9340").String()
metricsPath = app.Flag("web.metrics-path", "Path under which to expose metrics").Default("/metrics").String()
probePath = app.Flag("web.probe-path", "Path under which to expose the probe endpoint").Default("/probe").String()
endpointURL = app.Flag("s3.endpoint-url", "Custom endpoint URL").Default("").String()
app = kingpin.New(namespace+"_exporter", "Export metrics for S3 certificates").DefaultEnvars()
listenAddress = app.Flag("web.listen-address", "Address to listen on for web interface and telemetry.").Default(":9340").String()
metricsPath = app.Flag("web.metrics-path", "Path under which to expose metrics").Default("/metrics").String()
probePath = app.Flag("web.probe-path", "Path under which to expose the probe endpoint").Default("/probe").String()
endpointURL = app.Flag("s3.endpoint-url", "Custom endpoint URL").Default("").String()
disableSSL = app.Flag("s3.disable-ssl", "Custom disable SSL").Bool()
forcePathStyle = app.Flag("s3.force-path-style", "Custom force path style").Bool()
)

log.AddFlags(kingpin.CommandLine)
Expand All @@ -169,6 +171,9 @@ func main() {
cfg.WithEndpoint(*endpointURL)
}

cfg.WithDisableSSL(*disableSSL)
cfg.WithS3ForcePathStyle(*forcePathStyle)

svc := s3.New(sess, cfg)

log.Infoln("Starting "+namespace+"_exporter", version.Info())
Expand Down

0 comments on commit fdf2ad7

Please sign in to comment.