This is a feature enhancement. Initially I was working on a Helm chart for this app (https://github.com/helm/charts/pull/7927), and I thought it would be better to have environment variable support. I will probably resume work on the Helm chart, but the maintainers of that repo are slow as hell; probably better if Timescale had its own repository for Helm charts to be honest.
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -a -installsuffix cgo --ldflags '-w' -o prometheus-postgresql-adapter
And then ran docker-compose up --detach --build with some environment variables mapped to the container. I can confirm that the prometheus-postgresql-adapter successfully reads the environment variables injected.
Types of changes
[ ] Bug fix (non-breaking change which fixes an issue)
[X] New feature (non-breaking change which adds functionality)
[ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
Checklist:
[X] My code follows the code style of this project.
[X] My change requires a change to the documentation.
Description
Solves issue https://github.com/timescale/prometheus-postgresql-adapter/issues/43. In general, to make the app more compliant with the 12Factor standard (https://12factor.net/config), and for security reasons mentioned in the issue, all CLI flags have an equivalent environment variable.
Motivation and Context
This is a feature enhancement. Initially I was working on a Helm chart for this app (https://github.com/helm/charts/pull/7927), and I thought it would be better to have environment variable support. I will probably resume work on the Helm chart, but the maintainers of that repo are slow as hell; probably better if Timescale had its own repository for Helm charts to be honest.
I'm not sure if this qualifies as a breaking change, but the CLI flags should be renamed to not use dots (
.
) in them. See my comment here (https://github.com/timescale/prometheus-postgresql-adapter/issues/43#issuecomment-481879131), but in short, the BASH shell doesn't allow for dots in environment variables names when you runexport
.How Has This Been Tested?
Locally ran the build command:
And then ran
docker-compose up --detach --build
with some environment variables mapped to the container. I can confirm that theprometheus-postgresql-adapter
successfully reads the environment variables injected.Types of changes
Checklist: