(Quick Reference)


This event hook closure defines the config options that your plugin supports.


{docx} def doWithConfigOptions = { 'organization.name'(type: String, defaultValue: 'My Corp (set plugin.platformCore.organization.name)') 'site.name'(type: String, defaultValue: 'Our App (set plugin.platformCore.site.name)') } {docx}

This block, from the platform-core plugin, defines two configuration values of type String, with a default value.

You can also supply a custom validator:

{docx} def doWithConfigOptions = { 'concurrentConnections'(type: Integer, defaultValue: 10, validator: { v -> v < 500 ? null : 'concurrent.connections.too.big' } } {docx}

Behaving just like constraint validators, your validator returns null for "ok" or an i18n message string for the error.

Method Calls

Any method calls are assumed to be dot-separated Config key paths relative to the plugin's namespace.

The arguments are a Map that supports the following values:

typeAn optional Class. If specified, the value of this Config item (after apply the default) must be compatible with this type
defaultValueAn optional default value. If no value is explicitly supplied by the application or any plugin, this value will be merged into the Config
validatorAn optional Closure to validate the supplied value. If validation fails, a warning will be logged and the defaultValue used


The following property is supported in the DSL:

legacyPrefixOptional string value that will be used to copy legacy configuration values for you. Values declared in your doWithConfigOptions that exist in this legacy namespace will automatically be copied into your namespaced pluginConfig so you do no longer need to check your old values