relaxhax
relaxhax

Reputation: 11

How to include webapp_config.txt to Play's dist zip?

I've created a prod.conf file which is my configuration file for my production environment. I'd like to ask, is there a way so that whenever I do play dist, the webapp_config.txt file that I've created is included in the zip and placed in the root directory of my web app?

Thanks in advance!

Upvotes: 0

Views: 117

Answers (1)

Jakob Odersky
Jakob Odersky

Reputation: 1461

Check out the sbt task mappings in dist. It is a sequence of tuples (File -> String) that represent which files will be mapped to which paths in the resulting zip file.

In your case the steps to follow are:

  1. add addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "0.7.1") to the project/plugins.sbt file

  2. import com.typesafe.sbt.SbtNativePackager._ in your build file

  3. add the following to your project settings

    mappings in (Universal, packageBin) += (baseDirectory.value / "webapp_config.txt") -> "webapp_config.txt"
    

Upvotes: 1

Related Questions