Commits
Tarun Sukhani authored 0d699bffe5e
feat(config): fail the start on violated declared configuration keys (PF-179)
A key whose ${VAR} placeholder nothing defined kept the literal
placeholder and the application started with it; a typo in an
enum-like key fell back to a default without a word. Only
application.secret was checked.
play.ConfigRequirements is a registry of declared keys.
require(owner, key) demands a value: present, non-empty, no unresolved
placeholder. requireIn(owner, key, allowed...) constrains a value to a
set, ignoring case and surrounding whitespace, and passes when the key
is absent. Plugins declare from onConfigurationRead();
Play.readConfiguration() empties the registry just before that
broadcast and re-declares the framework's own key,
application.log.format (text or json).
Play.start() checks beside the application.secret check and throws one
ConfigurationException that lists every violation with its owner and
how to fix it: exit 1 in PROD, the error page in DEV. The check is not
part of the read, so play precompile, bundle and dist still succeed
without production variables. Keys nobody declares behave as before.
A declaration owned by a plugin class is skipped while no loaded plugin
of that class is enabled.
Logger.LoggerInit now trims application.log.format, so a value the
check accepts is also the one honoured.
Behaviour change: application.log.format set to anything but text or
json, or to a placeholder nothing defines, no longer starts.
Docs: "Declaring required configuration" and a reference entry for
application.log.format in configuration.textile, which also showed the
shell's ${VAR:-default} form for what is ${VAR:default} here (corrected
there and in the 1.12.0 release notes); logs.textile; AGENTS.md.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KDUoh3KhBpfjXn4rV6H356