Dynamic Db Config Property Plugin

  • Tags: configuration, config
  • Latest: 0.2.6
  • Last Updated: 20 March 2014
  • Grails version: 2.2 > *
2 votes
Dependency:
compile ":dynamic-db-config-property:0.2.6"

 Documentation  Source  Issues

Summary

This plugin gives your application the ability to change the config properties without restarting the application. The values in Config.groovy are persisted in database when application is run-for the first time after installing the plugin.

Installation

grails install-plugin dynamic-db-config-property

Description

This plugin gives your application the ability to change the config properties without restarting the application. The values in Config.groovy are persisted in database when application is run-for the first time after installing the plugin.

Meanwhile, for one Grails Project, usually more than 50 properties in config.groovy, but most them are generated by Grails framework. Indeed, there is only a small portion of properties in your config.groovy that is needed to maintain later on. What we are concerned about is the frequently-used properties. Therefore, there is a interface to help you to simply tick boxes to move the properties you want to maintain forwards to save into the database. Then all management operations such as CRUD are in the management page. More importantly, only those properties saved into DB are synchronized with GrailsApplication.config object, which is quite handy for you to focus on managing these useful ones.

It is sometimes true that you could not restart server to add a new property when the server is busy running. After using the plugin, it works even you only create the new property in Database and have not added in Config.groovy yet.

In addition, in the Property Status page you could check the values in Config.groovy, the values in DB and the currently active values on running.

Features

  • Dynamic (on-the-run) changes to your Config properties.
  • Keeping latest values of Config properties from Database in the GrailsApplication.config object at the run-time.
  • Supports various data types as values for the config property (Integer, Boolean, String, Float, Long, Double).
  • In the 'Property Status' page you could compare the previously default values in Config.groovy and the currently active values on running.
  • All views are generated by your own layout main.gsp.
  • The plugin contains a single domain class named ConfigProperty and a set of controller's methods and views.
Setp1 Installation Installing the dynamic DB config property plugin in BuildConfig.groovy:

plugins{ compile ":dynamic-db-config-property:0.2.2" }

Setp2 Create CONFIG_PROPERTY table(acceptable) If you did not config "dbCreate" with "create-drop" or "create" in DataSource.groovy, you might need to create the table manually. There is the SQL (Oracle) below:

create table config_property (id number(19,0) not null, version number(19,0) not null, description varchar2(255 char), key varchar2(255 char) not null, value varchar2(255 char) not null, primary key (id));

Setp3 Set up privilege(applicable) If you used Spring Security, to config the privilege using method below:

In Config.groovy, set up privilege of spring security for the plugin:

grails.plugins.springsecurity.interceptUrlMap = [

'/ configProperty/create':['xxxxxxx']

'/ configProperty/list':['xxxxxxx']

]

Setp4 Set up properties to save into DB Use the URL:${your domain}/configProperty/list to access the plugin management page. In "Property Status" page, simply tick boxes to save into DB.

RELEASES:

0.2.6 Increased the restriction for the fields up to 2000 characters.

0.2.2 Integrated previous three pages in to a "Property Status" page, which makes it to be simpler and nicer.

0.0.1 First Release