Skip to content
deepak-mittal edited this page Oct 2, 2010 · 17 revisions

Grails-Dynamic-Config-Plugin

This plugin is created using Grails 1.3.4 and gives your application the ability to dynamically change the config properties as defined in Config.groovy.

This plugin is useful in situations where you need to make run-time changes in the behavior of your application through config properties. The plugin creates a single domain class named ConfigProperty.

**NOTE: You need not re-deploy or restart your application after making the config property changes through this plugin. **

###Features###

  • Dynamic (on-the-run) changes to your Config properties.

  • Addition of new config property at the run-time.

  • Supports various data types as values for the config property (Integer, Boolean, String, Float, Long, Double).

  • Persists config properties in the database at the time of bootstrap if there is no already persisted object of ConfigProperty domain class (used by the plugin), else it updates the config map values from the database.

  • Use url /myapp/configProperty/updateConfigMapToDB to persist current map values into the database.

  • Use url /myapp/configProperty/updateConfigMapFromDB to update current map values from the database.

###User Guide###

  1. Install the plugin using the following command:
grails install-plugin dynamic-config
  1. To use the plugin just goto the URL: //configProperty, where you will find the CRUD to create, edit or delete all of the config properties present in Config.groovy.

It is as simple as this :-)

KNOWN ISSUES:

  1. Do not use suffix 'l' at the end of long values. This will make the value considered as String.

  2. Values ending-with single-quote(') do not get persisted / updated.

  3. Values containing tripple-quotes(''') do not get persisted / updated.

  4. As of now, the plugin DOES NOT support the persistence of List as well as Closure values from the Config.groovy, though the persistence of List values is planned to be supported soon.

IMPORTANT: In the current version, no security feature is implemented. You need to protect access to configProperty controller using a Grails Filter or whatever other security mechanism that you use in your application to manage access.

Please feel free to come up with new enhancements or suggestions. Reach me at [email protected].

###RELEASES:###

0.1

  1. First Release

0.2

  1. Fixed bug related to updating config map from database on bootstrap.

  2. Added two helper urls /myapp/configProperty/updateConfigMapToDB & /myapp/configProperty/updateConfigMapFromDB

###FAQs:###

Ques: I am getting the following error on application starup after I iinstall the plugin :

org.hibernate.DuplicateMappingException: duplicate import: ConfigProperty refers to both com.myapp.ConfigProperty and 
org.grails.plugins.dynamicConfig.ConfigProperty (try using auto-import="false")

Ans: The plugin uses the domain class ConfigProperty, so if your application uses the domain class with the same name, either rename your domain class or change its database mapping.

Clone this wiki locally