Skip to content

raymanoz/typesafeconfig-reloaded

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

typesafeconfig-reloaded Build Status

A typesafe config pimp with a easy to use n-deep fallback strategy

Requirements

Usage

Add the following lines to your build.sbt

resolvers += "Raymond Barlow's repo" at "http://repo.raymanoz.com/"

libraryDependencies += "com.raymanoz.reloaded" %% "reloaded" % "27"

Start hacking

To load config from the file dev.conf, placed anywhere on the classpath...

import com.raymanoz.reloaded.FallbackConfigurationLoader
val config: Config = FallbackConfigurationLoader.load("dev")

A fallback conf file is one which provides defaults for properties e.g.

dev.conf

fallback=prod
http.port = 1234

prod.conf

fallback=reference

reference.conf

http.port = 8000
statusUrl = "http://localhost:"${http.port}"/status"

In this case...

FallbackConfigurationLoader.load("prod").getString("port") // == "8000"
FallbackConfigurationLoader.load("prod").getString("statusUrl") // == "http://localhost:8000/status"
FallbackConfigurationLoader.load("dev").getString("port") // == "1234"
FallbackConfigurationLoader.load("dev").getString("statusUrl") // == "http://localhost:1234/status"

For more examples see

Code license

Apache License 2.0

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published