sql_exporter icon indicating copy to clipboard operation
sql_exporter copied to clipboard

Interpolate environment variables in config

Open dbevacqua opened this issue 6 years ago • 1 comments

As a general solution to the type of problem which #7 deals with, it would be nice to be able to reference environment variables in some or all config. For example, if we were to use golang templates, it might look like:

target:
  data_source_name: 'sqlserver://prom_user:{{.PROM_PASSWORD}}@dbserver1.example.com:1433'

This could be done either for the entire file or for specific keys. I think it would be straightforward enough and I'd be happy to do it if you think it would be useful.

dbevacqua avatar Aug 28 '19 15:08 dbevacqua

Here's a simple implementation:

https://github.com/free/sql_exporter/compare/master...treatwell:master

dbevacqua avatar Sep 05 '19 18:09 dbevacqua