struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christoph Nenning <Christoph.Nenn...@lex-com.net>
Subject Re: How to disable devMode in prod
Date Thu, 15 Sep 2016 12:39:55 GMT
> >> 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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message