Swapping out .properties files for different environments

I have a Play 2 application that uses some external Java libraries. Some of these (e.g. the Paypal merchant sdk) depend on having a properties file for configuration (e.g. sdk_config.properties) which I have put into the conf directory.

When deploying this application to a different environment using play dist is there a sensible way to swap out properties files for each environment? For the main configuration in application.conf this is straightforward e.g. start -Dconfig.resource=prod.conf, but I am not sure how to do something similar for the properties files.

Answers


The support for specifying config.resource (and a lot of other nice stuff) is built into the typesafe config lib that comes with play. Other third party libs that depend on properties files on the classpath may or may not accept something like that, so if you are lucky then there is a lib specific way to point it to a separate config file.

If they do not then the only option is to somehow provide a different file on the classpath for the different environments. This could basically be done in two ways:

A. To not ship the file with the artifact and instead provide it per environment and add that on the classpath when starting play.

B. To create different artifacts for the different configurations, this would require you to customize dist to create one artifact per distinct env.

I would go for A since it allows there to be one artifact that can be run anywhere, but it might add some annoyances to running the app in a dev env etc.


Need Your Help

Creating a copy of the buffer pointed by host ptr on the GPU from GPU kernel in OpenCL

opencl gpu gpu-programming

I was trying to understand how exactly CL_MEM_USE_HOST_PTR and CL_MEM_COPY_HOST_PTR work.

Website Search and Scraping

html search web-scraping screen-scraping

I travel a lot for business and frequent kayak.com and it got me thinking about how kayak can accomplish the search and scraping of all these websites.