I have a Scala Play application builded using sbt.
When I build the package using sbt dist
command, this will result in an archive deployed in /target/universal
path. The problem is that I have 3 configuration files:
- application.conf
- dev.conf
- prod.conf
If I try to run sbt dist -Dconfig.resource=prod.conf
, I get an error:
[error] Expected ID character
[error] Not a valid command: prod (similar: stopProd, runProd, reload)
[error] Expected project ID
[error] Expected configuration
[error] Expected ':' (if selecting a configuration)
[error] Expected key
[error] Not a valid key: prod (similar: products, projectId, project-id)
[error] prod.conf
Even if I use quotes, or -Dconfig.file
, the result is the same. Where am I wrong? thanks
late edit:
sbt dist
will build the bin/*.bat
files, but the rest of files will remain unbuilded. So, I think if I go for this .zip
solution, the package will be the same for all environment types (dev, stage, prod), but I can choose the config file when I run the command to start application:
for example, for prod I can use:
nohup ./app-name-1.0/bin/app-name -J-Xms8g -J-Xmx8g -Dconfig.resource=prod.conf -Dhttp.port=7777</dev/null>> logfile.log 2>&1 &
where -Dconfig.resource=prod.conf
make what I want in this post.