scalaplayframeworkplayframework-2.5scala-template

Can't take configuration value in view at 2.5.3 version?


@play.Play.application.configuration.getString("application.host")

how can I take configuration value in view at 2.5.3 version?

Note that the view is used everywere. So I'm searching solution without setting parameters in all controllers.


Solution

  • import play.api.Configuration
    
    val config = Configuration.load()
    val mode = config.getString("application.host", defaultValueString)
    

    the document is https://www.playframework.com/documentation/2.5.3/api/scala/index.html#play.api.Configuration

    Good luck with you