it's possible to add groovy script as config source?
The ConfigDataBuilder only support json/yaml/properties file as config source. but sometimes i want to setting config item dynamically(eg, evaluating the script code & apply the result as config item).
just wondering if it's possible to add groovy script as config source?
Re: it's possible to add groovy script as config source?
The Ratpack core team believes that there are some drawbacks to ConfigObject, especially the fact that it comes with autovivification (https://en.wikipedia.org/wiki/Autovivification) which might lead to subtle bugs and therefore is reluctant to add support for it to core even though it's such a commonly used configuration mechanism in the Groovy world.
There is nothing stopping you from providing a custom implementation of ratpack.config.ConfigSource and then registering a source using ServerConfigBuilder.add(ConfigSource) - ServerConfigBuilder is the type backing the closure passed into Groovy.Ratpack.serverConfig().
There is another quick and dirty option of parsing the script in your serverConfig block, transforming it into a Properties instance and then adding that to the server config: