Standardized external configuration for your app

  • Tags : configuration, external
  • Latest : 2.0
  • Last Updated: 17 January 2011
  • Grails version : 1.2.2 > *
  • Authors : Philip Stehlik
2 votes
Dependency :
compile ":external-config:2.0"

Documentation

Summary

Installation

grails install-plugin external-config

Description

Intro

Provides easy and consistent facility to have externalized configuration files for your Grails applications.

Installation

Install as any plugin with
grails install-plugin external-config

Usage

The plugin replaces (creates a copy of your current config in 'grails-app/config' before writing the new one) your Config.groovy and DataSource.groovy files with standardized config that includes external config files in the Grails config building. To execute the install of an externalized Config.groovy run
grails externalize-config
The plugin's provided Config.groovy is set up to make Grails look in two places for external configuration files, one for easy usage during development and one more bound to the system it runs on via environment variables.

The two locations are:

  • ~/.grails/<appName>Config/Config.groovy or ~/.grails/<appName>Config/DataSource.groovy
  • Files specified by the two environment variables <APPLICATION_NAME>_CONFIG_LOCATION and <APPLICATION_NAME>_DATASOURCE_LOCATION
The environment variable names are 'cleaned' to the extent that - is replaced with _

Example

Assume your application is called my-app the plugin created config expects your configuration files to be
  • ~/.grails/my-appConfig/Config.groovy
  • ~/.grails/my-appConfig/DataSource.groovy
or the single files specified by environment variables
  • MY_APP_CONFIG_LOCATION
  • MY_APP_DATASOURCE_LOCATION