sql_exporter
sql_exporter copied to clipboard
Passing DSN as argument fails if data_source_name field is missing from config
Hey there! We use the config.data-source-name
flag to more securely pass the DSN to this exporter. It appears that the exporter fails to start, if the data_source_name
field is missing from the config, even though it's not used in this use case.
Appears to be because the unmarshalling validation done here is before the config.data-source-name
is evaluated a couple lines later.
Fix might be to have the unmarshalling validation be aware of this flag? Not sure... what do you think?
Btw, our workaround was to include the data_source_name
in the config file with a dummy value, if anyone else comes across this.
Per above. On kubernetes it's easier to pass just the DSN from a secret rather than making all config a secret. Thanks for the project~
I think it's already mentioned here https://github.com/free/sql_exporter/issues/7#issuecomment-388821968