Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running the application using runProd ignores configuration file #10913

Open
JFCote opened this issue Jun 30, 2021 · 4 comments
Open

Running the application using runProd ignores configuration file #10913

JFCote opened this issue Jun 30, 2021 · 4 comments

Comments

@JFCote
Copy link

JFCote commented Jun 30, 2021

Play Version

Latest: 2.8.8

API

Java

Operating System

Windows 10

JDK

openjdk 11.0.11 2021-04-20
OpenJDK Runtime Environment AdoptOpenJDK-11.0.11+9 (build 11.0.11+9)
OpenJDK 64-Bit Server VM AdoptOpenJDK-11.0.11+9 (build 11.0.11+9, mixed mode)

Expected Behavior

  1. In the command line, I run this: sbt -Dconfig.file=conf\my.conf runProd
  2. The application starts in prod mode using the values in my provided configuration file (database, variables, etc..)

Actual Behavior

  1. In the command line, I run this: sbt -Dconfig.file=conf\my.conf runProd
  2. I receive errors that indicate that Play is not using my configuration at all (missing datasource, missing Log4j config, etc..).
  3. For more information, see this Stack Overflow question: https://stackoverflow.com/questions/65905939/play-framework-runprod-not-accepting-custom-config-file

Please note that if I run sbt -Dconfig.file=conf\my.conf run, everything works fine but it's not in "prod mode" which I need for some testing. Looks like a bug, either in the documentation or in the code.

@JFCote JFCote changed the title Running the application using runProd ignore configuration file Running the application using runProd ignores configuration file Jul 6, 2021
@JFCote
Copy link
Author

JFCote commented Sep 17, 2021

Is there anything I can do to help fix this bug? I can work hand in hands with developer's from the Play Framework if necessary (on slack or gitter, let me know). I just don't know how to code in Scala, so I can propose a PR... @gmethvin
Thanks

@abteilung6
Copy link

Try sbt run -Dconfig.resource=application.prod.conf runProd

@JFCote
Copy link
Author

JFCote commented Nov 16, 2021

@abteilung6 Thanks for the suggestion, but it doesn't work. I get exactly the same error. It's like the runProd completely ignore the configuration file passed in the command line.

@ljdelight
Copy link

I also had this issue, but using Intellij. I found a solution but this is a horrible user experience... it comes down to Intellij's run configurations being significantly different between the sbt run vs sbt runProd.

  • RUN DEVELOPMENT (IDEA)
    • Tasks: run
    • VM Parameters: -Dconfig.file=./conf/dev.conf -Dlogger.file=./conf/logback-dev.xml
  • RUN PRODUCTION (IDEA)
    • Tasks: THE QUOTES ARE REQUIRED!!! "runProd -Dlogger.resource=logback-dev.xml -Dconfig.resource=dev.conf"
    • VM Parameters: Emtpy

I'm not sure if it's Play or Intellij getting things mixed up. But correct usage is not clear.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants