free / sql_exporter

Database agnostic SQL exporter for Prometheus
MIT License
539 stars 172 forks source link

Support data source configuration outside of sql_exporter.yml #7

Open marcinbudny opened 6 years ago

marcinbudny commented 6 years ago

Instead of specifying the data_source_name directly in sql_exporter.yml, provide an option to point to external file or environment variable, that contains the data source config.

Use case: I want to store the credentials to the database securely in a Kubernetes secret, while the sql_exporter.yml would be a Kubernetes config map. There is no easy way to interpolate the secret into the config map. But if I was able to point to an external file on env variable, the problem would be solved.

free commented 6 years ago

Done. With apologies for not even replying until now.

There exists now a flag, config.data-source-name, which will override the value of target.data_source_name, as defined in the configuration file. Note that you still need to provide a non-empty value for target.data_source_name in the configuration file, if only for documentation purposes.

marcinbudny commented 6 years ago

Thanks!