GithubHelp home page GithubHelp logo

rlovtangen / external-config Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sbglasius/external-config

0.0 2.0 0.0 89 KB

Grails 3 plugin to handle multiple config files like Grails 2.x did

Groovy 93.94% Shell 6.06%

external-config's Introduction

External-Config

Build Status

This plugin will mimic the Grails 2 way of handling external configurations defined in grails.config.locations.

Installation

Add dependency to your build.gradle:

dependencies {
    compile 'org.grails.plugins:external-config:1.0.0'
}

To use a snapshot-version

add JFrog OSS Repository to the repositories:

repositories {
    maven { url "https://repo.grails.org/grails/core" }
}

and specify the snapshot version as a dependency:

dependencies {
    compile 'org.grails.plugins:external-config:1.0.0-SNAPSHOT'
}

Usage

Locate your Grails projects Application.groovy and implement the trait grails.plugin.externalconfig.ExternalConfig:

import grails.plugin.externalconfig.ExternalConfig

class Application extends GrailsAutoConfiguration implements ExternalConfig {
    static void main(String[] args) {
        GrailsApp.run(Application, args)
    }
}

This will add external-config loading to your Grails application.

Then define the property grails.config.locations. This can be done in either application.yml like this:

grails:
    config:
        locations:
            - classpath:myconfig.groovy
            - classpath:myconfig.yml
            - classpath:myconfig.properties
            - file:///etc/app/myconfig.groovy
            - file:///etc/app/myconfig.yml
            - file:///etc/app/myconfig.properties
            - ~/.grails/myconfig.groovy
            - ~/.grails/myconfig.yml
            - ~/.grails/myconfig.properties

or in application.groovy like this:

grails.config.location = [
        "classpath:myconfig.groovy",
        "classpath:myconfig.yml",
        "classpath:myconfig.properties",
        "file:///etc/app/myconfig.groovy",
        "file:///etc/app/myconfig.yml",
        "file:///etc/app/myconfig.properties",
        "~/.grails/myconfig.groovy",
        "~/.grails/myconfig.yml",
        "~/.grails/myconfig.properties"
]

Notice, that ~/ references the users $HOME directory.

The plugin will skip configuration files that are not found.

For .groovy and .yml files the environments blocks in the config file are interpreted the same way, as in application.yml or application.groovy.

external-config's People

Contributors

sbglasius avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.