sql_exporter icon indicating copy to clipboard operation
sql_exporter copied to clipboard

Passing DSN as argument fails if data_source_name field is missing from config

Open benclapp opened this issue 5 years ago • 3 comments

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?

benclapp avatar Dec 02 '19 04:12 benclapp

Btw, our workaround was to include the data_source_name in the config file with a dummy value, if anyone else comes across this.

benclapp avatar Dec 02 '19 04:12 benclapp

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~

karlskewes avatar Dec 02 '19 06:12 karlskewes

I think it's already mentioned here https://github.com/free/sql_exporter/issues/7#issuecomment-388821968

MrwanBaghdad avatar Jan 05 '20 22:01 MrwanBaghdad