Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

[#1044] Fixed case for dev and prod modes in application.py #339

Merged
merged 1 commit into from

4 participants

@afathalla

Now it shouldn't differ if you specify upper or lowercase prod or dev in application.mode

@pepite
Owner

Why is it a problem? I think it is fine that it is case sensitive as long as it is consistent.

@pepite pepite closed this
@afathalla

No, it isn't consistent. The server starts in development mode but doesn't attach the debugger if you use uppercase. Here's the original description from the lighthouse ticket

One result of this is that when you run an application with application.mode=DEV then Play says You're running Play! in DEV mode but does not listen for Java debugger connections (no Listening for transport dt_socket at address: 8000 output).

@pepite pepite reopened this
@pepite
Owner

Ok thanks

@pepite pepite merged commit 482b191 into from
@orefalo

maybe toupper would help here.

What if I use "Dev" ?

@pepite
Owner

we should not allow Dev or dEV or any other combinations. I am already wondering if supporting dev == DEV is such a good idea.

@jyyna

Why does it matter? Let users write it in any upper/lower case combination but check for a real value by lowercasing (or uppercasing) it.

@orefalo

@jyyna: that's what I meant

@jyyna

and java part of Play - see https://github.com/playframework/play/blob/master/framework/src/play/Play.java - does it too, there is toUpperCase() call after fetching configuration parameter.
this pull request should make the behaviour consistent in both java and python parts - #346

@pepite
Owner

Well the problem I have is that when you do something like play run --%prod you really mean prod, the profile "prod" and not "Prod" or "pRod" . And for the profile I really don't want to be case insensitive. At the same time I suppose this is not the same thing even if closely related.

@jyyna

I think we are trying to handle application.mode= configuration parameter not profile name here. Correct me if I am wrong, pls.

@pepite
Owner

Yes we agree I think. I am just saying, because it is usually related (you have a profile for dev or prod per environment) it is better to have it match your "dev" or "prod" environment (so same case). Anyway, it has been merged and it is not a biggy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 2 additions and 2 deletions.
  1. +2 −2 framework/pym/play/application.py
View
4 framework/pym/play/application.py
@@ -236,7 +236,7 @@ def java_cmd(self, java_args, cp_args=None, className='play.server.Server', args
application_mode = self.readConf('application.mode')
- if application_mode == 'prod':
+ if application_mode == 'prod' or application_mode == 'PROD':
java_args.append('-server')
java_policy = self.readConf('java.policy')
@@ -254,7 +254,7 @@ def java_cmd(self, java_args, cp_args=None, className='play.server.Server', args
java_args.append('-Dfile.encoding=utf-8')
- if self.readConf('application.mode') == 'dev':
+ if self.readConf('application.mode') == 'dev' or self.readConf('application.mode') == 'DEV':
if not self.play_env["disable_check_jpda"]: self.check_jpda()
java_args.append('-Xdebug')
java_args.append('-Xrunjdwp:transport=dt_socket,address=%s,server=y,suspend=n' % self.jpda_port)
Something went wrong with that request. Please try again.