title: How to create a custom environment in Grails?
body: <p><a href="http://grails.org/doc/latest/api/grails/util/Environment.html" rel="noreferrer">grails.util.Environment</a>, defines a number of preconfigured environments</p>
  
  <ul>
  <li>DEVELOPMENT</li>
  <li>PRODUCTION</li>
  <li>TEST</li>
  <li>CUSTOM</li>
  </ul>
  
  <p>When running a Grails command, the environment to use can be specified using a <code>-Denv</code> flag, e.g. <code>grails run-app -Denv=test</code>. You can also specify a block of code that is specific to a certain environment using closures such as:</p>
  
  <pre><code>environments {
      production {
          grails.serverURL = "http://www.changeme.com"
      }
      development {
          grails.serverURL = "http://localhost:8080/${appName}"
      }
      test {
          grails.serverURL = "http://localhost:8080/${appName}"
      }
  }
  </code></pre>
  
  <p>These environment-specific closures can be used in <code>Bootstrap.groovy</code> and <code>Config.groovy</code>, are there other places?</p>
  
  <p>Also, is it possible for me to define my own environment, e.g. <code>PRE_PRODUCTION</code>, such that it will work with the closures above and the <code>-Denv</code> flag?</p>
  
  <p>Finally, can the <code>CUSTOM</code> environment be used with the <code>-Denv</code> flag?</p>