paradigmatic / Configrity

Simple, immutable and flexible configuration library for scala.
Other
132 stars 19 forks source link

Support for Domains. #6

Closed sheki closed 12 years ago

sheki commented 12 years ago

Configrity could support Domain's which can be picked up from the environment.

This could be used to pick up different config in different environments like Testing, Production, Development.

paradigmatic commented 12 years ago

Currently, you can define "domains" as top level config blocks. For instance given the config file app.conf:

development {
  storage = mem    
}
production {
  storage = db
}

You can for example retrieve the config per domain as:

val domain = "development"                    // change here to get production config
val config  = Configuration.load( "app.conf" ).detach( domain )  
val storage = config[String]( "storage" )     // storage == "mem"

Is it enough for your needs ? If it's not the case could you provide an example of the behavior/syntax you are looking for ?

sheki commented 12 years ago

I can work around with this.