java - play 2.4.x current application environment -
Is there a function to return any existing work environment to a Play Framework application? I tried the following but it is not working properly;
string environment = play.api.Play.Mode Note: I don isDev () isProd ( ) you want to use the stuff, I want to be able to create custom environments
PlayFramework 2.x only supports 3 modes: Prod, Dev and Test. The second is used for production, the second provides more development joints such as only the audit classes. The last one is like another but with trial libraries.
Play 1.x also had ID , which was able to use as a different environment. For example staging or instances of distributed servers Play 2.x does not unfortunately support id . But you can get the same effect manually. Suppose you want to run your application in 'staging' mode. First you have to place the configuration file with the original configuration file, but it is known as the application.staging.conf . The second step Global. Scala code responsible for managing configuration files, something like: Import java.io.file import do play.api._ import com.typesafe.config.ConfigFactory object Global Certification enhances {override def onLoadConfig (configuration: path: file, Clasloder: Clasloder mode: Modkmod): configuration = {val env = System .getProperty ("environment") val envConfig = config ++ configuration (ConfigFactory.load (s "App. $") As you see The environment value reads and sees it (typical Confif environment, path, Clasloder mode)}} specific configuration file. the final phase of the game framework telling who should use it. the best way to start the command:
activator run -denagriy = staging work
Comments
Post a Comment