jamesfredley commented on PR #15407:
URL: https://github.com/apache/grails-core/pull/15407#issuecomment-3927894334
I think this is a POC and potentially a placeholder due to the following.
Config is scattered across **4 different mechanisms** with no unified
registry:
1. **`Settings` interfaces with string constants** -
`grails.config.Settings` (~45 keys) and
`org.grails.datastore.mapping.config.Settings` (GORM keys). These are plain
`String` constants with Javadoc. Discoverable via reflection at build time.
2. **`@ConfigurationProperties` classes** - Only ~5 in grails-core
(`grails.cors`, `grails.cache`, `grails.views.markup`, `grails.views.json`,
`grails.databinding`). These ARE Spring Boot's standard mechanism and would
show up in metadata - but there are no `spring-configuration-metadata.json`
files anywhere in the repo.
3. **Hard-coded string literals** - Many config keys are just raw strings
like `config.getProperty('grails.some.key', Boolean, true)` scattered
throughout the codebase. No constants, no metadata, no discovery mechanism.
4. **External plugins** - Spring Security, Asset Pipeline, etc - each
defines their own config in their own repos. A single app startup can only
discover keys for plugins it actually loads.
### "start an app and dump config in bootstrap"
- **No complete enumeration API** - There's no
`grailsApplication.getAllKnownConfigKeys()`. The `Settings` interfaces give you
maybe 30% of the keys. The rest are string literals buried in code.
- **Plugin configs are external repos** - Spring Security defaults live in
`grails-spring-security`, not `grails-core`. Asset Pipeline lives in a
different GitHub org (wondrify). The app will need ALL plugins loaded.
- **Runtime vs. declared** - At runtime you can dump what's *set* easily but
would need a lot of code to iterate through everything and dump it
- **No `spring-configuration-metadata.json`** - Spring Boot's standard
solution for this (annotation processor generating metadata) has never been set
up for Grails. That's the gap.
### What could be done, likely for Grails 8
1. **Add `spring-boot-configuration-processor`** to grails modules that use
`@ConfigurationProperties` - this auto-generates
`spring-configuration-metadata.json` at compile time
2. **Migrate more config to `@ConfigurationProperties`** instead of raw
string lookups - a big refactor
3. **Write a Gradle task** that reflects over the `Settings` interfaces +
collects `@ConfigurationProperties` metadata + generates the adoc
But that's a big refactoring effort
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]