dropwizard-freemarker-config

Freemarker Configuration Parser for Dropwizard

License

License

Categories

Categories

DropWizard Container Microservices config Application Layer Libs Configuration
GroupId

GroupId

fi.jubic
ArtifactId

ArtifactId

dropwizard-freemarker-config
Last Version

Last Version

0.2.0
Release Date

Release Date

Type

Type

jar
Description

Description

dropwizard-freemarker-config
Freemarker Configuration Parser for Dropwizard
Project URL

Project URL

http://jubic.fi
Project Organization

Project Organization

Jubic Oy
Source Code Management

Source Code Management

https://github.com/jubicoy/dropwizard-freemarker-config

Download dropwizard-freemarker-config

How to add to project

<!-- https://jarcasting.com/artifacts/fi.jubic/dropwizard-freemarker-config/ -->
<dependency>
    <groupId>fi.jubic</groupId>
    <artifactId>dropwizard-freemarker-config</artifactId>
    <version>0.2.0</version>
</dependency>
// https://jarcasting.com/artifacts/fi.jubic/dropwizard-freemarker-config/
implementation 'fi.jubic:dropwizard-freemarker-config:0.2.0'
// https://jarcasting.com/artifacts/fi.jubic/dropwizard-freemarker-config/
implementation ("fi.jubic:dropwizard-freemarker-config:0.2.0")
'fi.jubic:dropwizard-freemarker-config:jar:0.2.0'
<dependency org="fi.jubic" name="dropwizard-freemarker-config" rev="0.2.0">
  <artifact name="dropwizard-freemarker-config" type="jar" />
</dependency>
@Grapes(
@Grab(group='fi.jubic', module='dropwizard-freemarker-config', version='0.2.0')
)
libraryDependencies += "fi.jubic" % "dropwizard-freemarker-config" % "0.2.0"
[fi.jubic/dropwizard-freemarker-config "0.2.0"]

Dependencies

compile (1)

Group / Artifact Type Version
org.freemarker : freemarker jar

provided (1)

Group / Artifact Type Version
io.dropwizard : dropwizard-core jar 1.0.0

test (1)

Group / Artifact Type Version
io.dropwizard : dropwizard-testing jar 1.0.0

Project Modules

There are no modules declared in this project.

dropwizard-freemarker-config

Library for using freemarker templates as configuration files. Inspiration for the library stems from Ruby on Rails framework that allows loading config/database.yml as an erb template.

Usage

Add dependency.

<dependency>
    <groupId>fi.jubic</groupId>
    <artifactId>dropwizard-freemarker-config</artifactId>
    <version>0.1</version>
</dependency>

Set ConfigurationFactoryFactory during application bootstrapping.

@Override
public void initialize (Bootstrap<Configuration> bootstrap) {

    bootstrap.setConfigurationFactoryFactory(
            new FtlConfigurationFactoryFactory<>(
                    new FtlDefaultEnvProvider()
            )
    );

}

Configuration specified when launching the packaged application jar can contain freemarker notation and has environment variables injected as env field of the model.

Examples

Database credentials with fallback values:

database:
  user: ${(env.DB_USER)!"fallback"}
  password: ${(env.DB_PASSWORD)!"fallback"}

Conditional sections. Toggling Hibernate SQL pretty printing on in development env:

database:
  properties:
  <#if (env.DEPLOYMENT_ENVIRONMENT)?? & env.DEPLOYMENT_ENVIRONMENT == "development">
    hibernate.format_sql: true
  </#if>
fi.jubic

Jubic Oy

Building the digital industry

Versions

Version
0.2.0