Warn if there are configuration keys in the configuration file that are not loaded by the configuration store#9575
Conversation
config/application.rb
Outdated
There was a problem hiding this comment.
is there a way we can log this in the prod-deployed boxes? Like Rails.logger.warn as well?
There was a problem hiding this comment.
Much to my disappointment, Rails.logger doesn't exist at this point unfortunately :/
There was a problem hiding this comment.
It will log, but only in provisioning logs, not any of the Rails logs (or if you start a console).
There was a problem hiding this comment.
somehow we have config.active_job.logger and Identity::Hostdata.logger
what if we store the unused keys back on IdentityConfig.unused_keys or something and then add an initializer that logs them?
There was a problem hiding this comment.
That's a great idea, I'll give it a shot
There was a problem hiding this comment.
Updated in f62fbfb, much bigger fan of that approach
…re not loaded by the configuration store changelog: Internal, Configuration, Warn if there are configuration keys in the configuration file that are not loaded by the configuration store
40d88e8 to
f62fbfb
Compare
Co-authored-by: Zach Margolis <zachmargolis@users.noreply.github.com>
🛠 Summary of changes
A small follow-up to #9566 to print out one class of unused configuration keys. This is specifically aimed at keys that are not defined in the configuration management, but are still defined in the configuration file. It is very likely this will find unused keys in deployed environments.
It would be better to log this to the log file, but logging is not set up at this point and in the interest of having a partial solution, I think this is an alright start.
Example output: