scala - Setting system property application.secret for Play and initialization order -


i'm using nettyservercomponents embed play in application server , i'm having problems setting required "application.secret" programatically.

the call make is:

system.setproperty("application.secret", secret) 

and can verify set via system.getproperty("application.secret"). initialization fail if put call inside class encapsulates , starts server this:

exception in thread "main" @6m0lkl2h5: configuration error   @ play.api.libs.cryptoconfigparser.get$lzycompute(crypto.scala:235)   @ play.api.libs.cryptoconfigparser.get(crypto.scala:204)   @ play.api.builtincomponents$class.cryptoconfig(application.scala:275)   ... 

if move same setproperty call earlier in code, works fine.

is there import play causes system properties read , cached? or other reason why it's not seeing value can see via getproperty?

i've solved initialization order problem , while rather specific setup, wanted post answer in case ends in similar situation.

configuration of play when using nettyservercomponents happens via line:

lazy val configuration: configuration = configuration(configfactory.load()) 

configfactory.load() part of com.typesafe.config , statically initializes configuration on first access. daemon i'm embedding play in uses configuration via net.ceedubs.ficus.ficusconfig means though above line lazy initialization, code had called configfactory.load() own configuration, meaning setting application.secret via setproperty had no effect.

for bonus fun, since both sets of code use configfactory.load(), had put

application {   secret = "foo" } 

in existing config file , play picked there.


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -