Skip to content

moebstibo/dropwizard-config-importable

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dropwizard-config-importable

Build Status

Use configuration imports in Dropwizard instead of copy-pasting files for each environment.

In foodpanda, we've been missing a popular Symfony2 feature which allows to import another file directly from your configuration file.

This can be used to:

  • split a large configuration file into multiple smaller snippets
  • override environment-dependent values

Installation

Maven

<dependencies>
    <dependency>
        <groupId>com.foodpanda</groupId>
        <artifactId>dropwizard-config-importable</artifactId>
        <version>${current.version}</version>
    </dependency>
</dependencies>

Gradle

compile 'com.foodpanda:dropwizard-config-importable:1.0.1'

Setup

Find your HelloApplication.java class and in the initialize method add this line:

bootstrap.setConfigurationFactoryFactory(new ImportableConfigurationFactoryFactory<>());

Example

base.yml:

database:
    driverClass: org.postgresql.Driver
    logValidationErrors: true

dev.yml:

imports:
   - base.yml

database:
   user: postgres

prod.yml:

imports:
   - base.yml

database:
   user: ${PROD_DB_USER}
   logValidationErrors: false

TODO

  • Circular reference detection
  • Support for other than local file resource types

About

Fork of vvondra/dropwizard-config-importable

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%