mmdc
mmdc

Reputation: 1746

playframework fall back configuration?

How to let playframework's configuration falls back to other configuration files if a default one is not exist.

For example, by default play use application.conf, if it does not exist, use c1.conf. if c1.conf does not exist, uses c2.conf.

I use play framework 2.3 in scala

Thanks.

Upvotes: 1

Views: 174

Answers (1)

Daniel Olszewski
Daniel Olszewski

Reputation: 14401

Such a feature doesn't exist in the Play framework. All you can do is to specify which file should be used as the configuration by passing one of the possible properties to your startup script.

Available parameters are described in the documentation under the section called Specifying alternative configuration file.

  • -Dconfig.resource - allows you to choice a file within your application
  • -Dconfig.file - sets a file from outside of your application
  • -Dconfig.url - uses a file loaded from the given URL

If none of this properties is passed to the application, it'll use application.conf as a default one.

To complete your task, you can write a bash script which will verify whether the script that you want to run exists. If so, pass it using one of aforementioned parameters or use a different one otherwise.

Upvotes: 3

Related Questions