You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Lukasz Lenart <lu...@apache.org> on 2016/09/15 11:11:11 UTC

How to disable devMode in prod

Hi,

Do you have a solution to disable devMode in production environment?
Based on some ENV variable or something?


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: How to disable devMode in prod

Posted by "Sreekanth S. Nair" <sr...@egovernments.org>.
👍 thanks Lukasz..



On Wed, Oct 12, 2016 at 4:47 PM, Lukasz Lenart <lu...@apache.org>
wrote:

> 2016-10-12 12:43 GMT+02:00 Sreekanth S. Nair <sreekanth.nair@egovernments.
> org>:
> > Cool 👍 thanks Lukasz, when can we expect this release ?
>
> Somehow around end of this year, maybe early.
>
>
> Regards
> --
> Łukasz
> + 48 606 323 122 http://www.lenart.org.pl/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: How to disable devMode in prod

Posted by Lukasz Lenart <lu...@apache.org>.
2016-10-12 12:43 GMT+02:00 Sreekanth S. Nair <sr...@egovernments.org>:
> Cool 👍 thanks Lukasz, when can we expect this release ?

Somehow around end of this year, maybe early.


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: How to disable devMode in prod

Posted by "Sreekanth S. Nair" <sr...@egovernments.org>.
Cool 👍 thanks Lukasz, when can we expect this release ?


On Wed, Oct 12, 2016 at 3:02 PM, Lukasz Lenart <lu...@apache.org>
wrote:

> and docs
> https://cwiki.apache.org/confluence/display/WW/Constant+Configuration#
> ConstantConfiguration-Valuesubstitution
>
> 2016-10-12 11:24 GMT+02:00 Lukasz Lenart <lu...@apache.org>:
> > Implemented
> > https://issues.apache.org/jira/browse/WW-4698
> >
> > 2016-09-16 9:06 GMT+02:00 Christoph Nenning <
> Christoph.Nenning@lex-com.net>:
> >>> Maybe the first step should be just simple, use ENV in
> >>> struts.xml/struts.properties
> >>>
> >>> <constant name="struts.devMode" value="${ENV.STRUTS_DEV_MODE:false}"/>
> >>>
> >>> wdyt?
> >>>
> >>>
> >>
> >> +1
> >>
> >>
> >>
> >> This Email was scanned by Sophos Anti Virus
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: How to disable devMode in prod

Posted by Lukasz Lenart <lu...@apache.org>.
and docs
https://cwiki.apache.org/confluence/display/WW/Constant+Configuration#ConstantConfiguration-Valuesubstitution

2016-10-12 11:24 GMT+02:00 Lukasz Lenart <lu...@apache.org>:
> Implemented
> https://issues.apache.org/jira/browse/WW-4698
>
> 2016-09-16 9:06 GMT+02:00 Christoph Nenning <Ch...@lex-com.net>:
>>> Maybe the first step should be just simple, use ENV in
>>> struts.xml/struts.properties
>>>
>>> <constant name="struts.devMode" value="${ENV.STRUTS_DEV_MODE:false}"/>
>>>
>>> wdyt?
>>>
>>>
>>
>> +1
>>
>>
>>
>> This Email was scanned by Sophos Anti Virus

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: How to disable devMode in prod

Posted by Lukasz Lenart <lu...@apache.org>.
Implemented
https://issues.apache.org/jira/browse/WW-4698

2016-09-16 9:06 GMT+02:00 Christoph Nenning <Ch...@lex-com.net>:
>> Maybe the first step should be just simple, use ENV in
>> struts.xml/struts.properties
>>
>> <constant name="struts.devMode" value="${ENV.STRUTS_DEV_MODE:false}"/>
>>
>> wdyt?
>>
>>
>
> +1
>
>
>
> This Email was scanned by Sophos Anti Virus

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: How to disable devMode in prod

Posted by Christoph Nenning <Ch...@lex-com.net>.
> Maybe the first step should be just simple, use ENV in
> struts.xml/struts.properties
> 
> <constant name="struts.devMode" value="${ENV.STRUTS_DEV_MODE:false}"/>
> 
> wdyt?
> 
> 

+1



This Email was scanned by Sophos Anti Virus

Re: How to disable devMode in prod

Posted by "Sreekanth S. Nair" <sr...@egovernments.org>.
Would be great to start with :-)

-- 
Thanks & Regards

Sreekanth Nair
Java Developer

On Thu, Sep 15, 2016 at 8:30 PM, Lukasz Lenart <lu...@apache.org>
wrote:

> Maybe the first step should be just simple, use ENV in
> struts.xml/struts.properties
>
> <constant name="struts.devMode" value="${ENV.STRUTS_DEV_MODE:false}"/>
>
> wdyt?
>
>
> Regards
> --
> Łukasz
> + 48 606 323 122 http://www.lenart.org.pl/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: How to disable devMode in prod

Posted by Adam Brin <ab...@digitalantiquity.org>.
It used to be that you could use an include statements in the struts.xml, e.g.     <include file="struts-local-settings.xml" />.  We used this to allow for different settings in production and development by importing different files.  This could be a nice “pair” if you can specify environment variables.

- adam
-- 
_________________________________________________________
Adam Brin
Director of Technology, Digital Antiquity
480.965.1278

> On Sep 15, 2016, at 8:00 AM, Lukasz Lenart <lu...@apache.org> wrote:
> 
> Maybe the first step should be just simple, use ENV in
> struts.xml/struts.properties
> 
> <constant name="struts.devMode" value="${ENV.STRUTS_DEV_MODE:false}"/>
> 
> wdyt?
> 
> 
> Regards
> -- 
> Łukasz
> + 48 606 323 122 http://www.lenart.org.pl/
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: How to disable devMode in prod

Posted by Lukasz Lenart <lu...@apache.org>.
Maybe the first step should be just simple, use ENV in
struts.xml/struts.properties

<constant name="struts.devMode" value="${ENV.STRUTS_DEV_MODE:false}"/>

wdyt?


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: How to disable devMode in prod

Posted by "Sreekanth S. Nair" <sr...@egovernments.org>.
Adding one of my thought, it would be better if we can externalize the
System ENV property key name (in Christoph code the key is "environment"),
because the application may already having some key to set its environment
to prod, staging or dev, etc.
eg: if we are using spring its having *spring.profiles.active *as to set
its current environment.

-- 
Thanks & Regards

Sreekanth Nair
Java Developer

Re: How to disable devMode in prod

Posted by Christoph Nenning <Ch...@lex-com.net>.
> >> Hi,
> >>
> >> Do you have a solution to disable devMode in production environment?
> >> Based on some ENV variable or something?
> >
> > Yes, we register a configProvider in web.xml which disables devMode 
based
> > on a system property.
> 
> Can you share source code of the provider?
> 
> 

Due to our 4 staging environments we have a custom configuration library 
which gives us environment specific config. That lib is used in 
struts-config-provider.

Without the lib code would look something like this:



public class DevModeConfigProvider implements ConfigurationProvider {

....

        public void register(ContainerBuilder builder, LocatableProperties 
props)
                throws ConfigurationException
        {
                if ("dev".equals(System.getProperty("environment"))) {
                        props.put("struts.devMode", "true");
                }
        }

....

}



regards,
Christoph

This Email was scanned by Sophos Anti Virus

Re: How to disable devMode in prod

Posted by Lukasz Lenart <lu...@apache.org>.
2016-09-15 13:35 GMT+02:00 Christoph Nenning <Ch...@lex-com.net>:
>> Hi,
>>
>> Do you have a solution to disable devMode in production environment?
>> Based on some ENV variable or something?
>
> Yes, we register a configProvider in web.xml which disables devMode based
> on a system property.

Can you share source code of the provider?


Thanks in advance
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: How to disable devMode in prod

Posted by "Sreekanth S. Nair" <sr...@egovernments.org>.
+1 for this change, it would be wonderful if this can be done.

-- 
Thanks & Regards

Sreekanth Nair
Java Developer

On Thu, Sep 15, 2016 at 5:21 PM, Christoph Nenning <
Christoph.Nenning@lex-com.net> wrote:

> > >> Hi,
> > >>
> > >> Do you have a solution to disable devMode in production environment?
> > >> Based on some ENV variable or something?
> > >
> > > Yes, we register a configProvider in web.xml which disables devMode
> based
> > > on a system property.
> >
> > Maybe it would be good to add such feature directly to Struts Core?
> >
> >
>
> Yeah, that would surly make it simpler for quite a lot of people.
>
> How shall we call that property?
>
> struts.environment?
> struts.staging?
> struts.production?
>
> What value(s) shall we use?
> Boolean?
> Strings like 'prod', 'test', 'dev', 'qa', 'staging'?
>
>
> Make name and value(s) configurable?
>
>
> At work we have 4 staging environments thus our property is not boolean.
>
>
> regards,
> Christoph
>
> This Email was scanned by Sophos Anti Virus
>

Re: How to disable devMode in prod

Posted by Christoph Nenning <Ch...@lex-com.net>.
> >> Hi,
> >>
> >> Do you have a solution to disable devMode in production environment?
> >> Based on some ENV variable or something?
> >
> > Yes, we register a configProvider in web.xml which disables devMode 
based
> > on a system property.
> 
> Maybe it would be good to add such feature directly to Struts Core?
> 
> 

Yeah, that would surly make it simpler for quite a lot of people.

How shall we call that property?

struts.environment?
struts.staging?
struts.production?

What value(s) shall we use?
Boolean?
Strings like 'prod', 'test', 'dev', 'qa', 'staging'?


Make name and value(s) configurable?


At work we have 4 staging environments thus our property is not boolean.


regards,
Christoph

This Email was scanned by Sophos Anti Virus

Re: How to disable devMode in prod

Posted by Lukasz Lenart <lu...@apache.org>.
2016-09-15 13:35 GMT+02:00 Christoph Nenning <Ch...@lex-com.net>:
>> Hi,
>>
>> Do you have a solution to disable devMode in production environment?
>> Based on some ENV variable or something?
>
> Yes, we register a configProvider in web.xml which disables devMode based
> on a system property.

Maybe it would be good to add such feature directly to Struts Core?


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: How to disable devMode in prod

Posted by Christoph Nenning <Ch...@lex-com.net>.
> Hi,
> 
> Do you have a solution to disable devMode in production environment?
> Based on some ENV variable or something?
> 
> 


Yes, we register a configProvider in web.xml which disables devMode based 
on a system property.


regards,
Christoph

This Email was scanned by Sophos Anti Virus