Tuesday, 15 July 2014

scala - How to access play configuration from a different module -



scala - How to access play configuration from a different module -

i have multi module sbt application, 1 of modules play application.

so module layout like:

/module1/ /module2/ /module-web <-- play 2.x /module3/

now in other modules using typesafe configuration library (com.typesafe.config).

now have module, module3, used within of module-web (play) , used in project. synchronize application.conf same in both play project , in other project.

my question is, how can access play application.conf within of module3?

module3 not have play framework dependency, typesaf config library.

i know play lets do:

play.current.configuration.getstring("db.driver")

is there similiar not using play.current method?

you can utilize configfactory class (most load method fit needs , can @ parsestring/parsefile methods), phone call toconfig():

import com.typesafe.config.configfactory import play.api.configuration val config = new configuration(configfactory.load()) config.getstring("db.driver") ..etc

scala playframework sbt

No comments:

Post a Comment