gdogaru
gdogaru

Reputation: 521

Access Play Configuration in Plain Scala Module

I have a Play app that I want to split into:

I want to create a S3Client object class, but when instantiating it I need to read the config values from application.conf. I can not use play.api.Play.current.configuration since this is not a play module.

Am I thinking this wrong? What would be the most elegant way to achieve what I want?

Upvotes: 0

Views: 379

Answers (2)

user4433284
user4433284

Reputation:

You don't even need to put a path in it.

If the application.conf is in the root directory, the config factory will automatically check if it's there.

Upvotes: 0

Nimrod007
Nimrod007

Reputation: 9913

just use typesafe Config factory

   import com.typesafe.config.ConfigFactory

   val conf = ConfigFactory.load("/path/to/your/conf/file/application.conf")

   //init your object with the conf file.

Upvotes: 1

Related Questions