Allow comment characters within configuration values when using my.cnf
This PR will fix https://github.com/prometheus/mysqld_exporter/issues/376
I've configured SpaceBeforeInlineComment option to allow comment characters within values.
see https://github.com/go-ini/ini/blob/b2f570e5b5b844226bbefe6fb521d891f529a951/ini.go#L97-L101
What about passwords with # or ; in them?
Oh, I see, this is to allow this. Wouldn't quotes used be a safer way to handle this?
EDIT: It turns out you can escape comment chars by using backticks or triple quotes.
~I stumbled upon this PR because I hit the same issue. Even when quoted, comment characters are still interpreted as the beginning of comments.~
~Here's a quick playspace demonstrating that using the same ini package: https://goplay.space/#dAkouM7WJ1T~
@patrickeasters Thanks for digging into the quoting. Perhaps we should update the README docs to recommend backtick quoting of passwords.
I would also be fine with simply flipping IgnoreInlineComment: true.
Either of those sound better than the rabbit hole of reading docs of mysqld_exporter's dependencies and cursing the inconsistency of INI parsers. 😄
Updating the README is of course the safest, but I don't imagine a ton of folks using inline comments in these INI files either.
This needs a DCO sign-off. You can use git commit -s --amend to add it.