Skip to content

Commit fcf724f

Browse files
authored
Merge pull request #20 from NETWAYS/env-passwd
Add option to set password via env variable
2 parents cae78cb + a8e49ee commit fcf724f

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,14 @@ See the `-help` output for more options.
5050
Path under which to expose metrics. (default "/metrics")
5151
```
5252

53+
### Environment Variables
54+
55+
Some values can be set via environment variables:
56+
57+
| Name | Description |
58+
| -------- | ----------- |
59+
| ICINGA2_EXPORTER_HTTP_PASSWORD | Password to use for basic auth |
60+
5361
### Cache
5462

5563
The exporter caches the responses from the Icinga2 API to decrease load on the API.

icinga2_exporter.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,12 @@ func main() {
111111
Level: logLevel,
112112
}))
113113

114+
if cliPassword == "" {
115+
if v, ok := os.LookupEnv("ICINGA2_EXPORTER_HTTP_PASSWORD"); ok {
116+
cliPassword = v
117+
}
118+
}
119+
114120
// In general, listen to gosec. But it this case, I don't think someone
115121
// is going to overflow the uint TTL for the cache lifetime.
116122
// nolint:gosec

0 commit comments

Comments
 (0)