Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I run Play framework in HTTPS only in the dev mode?

I'd like to run Play Framework over HTTPS only in the development mode and I've done so using the following bit of configuration:

https.port=9443
trustmanager.algorithm=JKS
keystore.file=conf/certificate.jks
keystore.password=password
certificate.password=password
application.mode=dev
%prodenv.application.mode=prod

This works when I run play run but in production we run play run --%prodenv and I want to disable HTTPS as the HTTPS is handled by Nginx. I'm lost with how to do this. I would like to do this via the configuration file and not via additional command-line arguments as it does defy the purpose of having all my application configuration in the application.conf file.

like image 523
Mridang Agarwalla Avatar asked Sep 09 '15 13:09

Mridang Agarwalla


People also ask

How do I run a play framework?

To run a Play application: Create a new Run Configuration – From the main menu, select Run -> Edit Configurations. Click on the + to add a new configuration. From the list of configurations, choose “sbt Task”

How do I run a debug in play framework?

To debug, start your application with activator -jvm-debug 9999 run and in Eclipse right-click on the project and select Debug As, Debug Configurations. In the Debug Configurations dialog, right-click on Remote Java Application and select New. Change Port to 9999 and click Apply.

What is play framework in Scala?

What is Play? Play is a high-productivity Java and Scala web application framework that integrates components and APIs for modern web application development. Play was developed by web developers for web application development. You will find Play's Model-View-Controller (MVC) architecture familiar and easy to learn.


2 Answers

One way to do it is to have two confs file: application.conf and prod.conf

application.conf stays the way it is and prod.conf would look something like

include "application.conf"
https.port = myProdPort

### other params to be overwritten

when launching your application in prod you can do

play run -Dconfig.file=/mypath/prod.conf
like image 114
John Avatar answered Sep 24 '22 01:09

John


sbt run -Dhttps.port=9443 -Dhttp.port=disabled

like image 42
dokam_scotland Avatar answered Sep 25 '22 01:09

dokam_scotland