sql_exporter
sql_exporter copied to clipboard
Support data source configuration outside of sql_exporter.yml
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.
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.
Thanks!