Environment Custom Configuration?

I have an application that needs to have some custom configuration… I looked through the docs and couldn’t find any examples of custom configuration. I just want to set some additional configuration options and then have the behavior of a handler change based on those values.

So, my questions, specifically, are:

  1. how do I add custom configuration options on a per-environment basis?
  2. how do I reference these custom configuration values inside a handler or view?


Hi Ben,

I followed this blog post by John Whish to get my environment settings configured:


I run 3 configurations

  1. the default ColdBox config settings - Production
  2. staging()
  3. workstation()

the above post describes configuring per-environment settings by machine name.

so if you had two environments outside of production you would set it up like so:

environments = {

workstation = “^localhost$”,
staging = “staging.mysite.com

function workstation(){
settings.coffee = “Americano”;

function staging(){
settings.coffee = “Columbian”;

Once the settings are configured and executed by the environment interceptor you would just reference them as you would any other setting by getSetting(‘coffee’) and get a different value per-environment.

Make sense?


perfecto. Thanks!

Rather than doing if (getSetting(“Environment”) == “production”) everywhere, I use the methods described by Nolan to override production settings.


// Production

coldbox =


// Much Removed

settings =
sendEmailFrom = “me@me.com
,allowDebugLogging = false
,allowAPICache = true

// etc…


public function development()
settings.allowAPICache = false;
settings.allowDebugLogging = true;

// or another way would be…
public functiond development()
local.devSettings = {
allowAPICache = false
allowDebugLogging = true

Looks like Nolan does the same. I just wanted to be clear that you can have some insane clean code in multiple environments without getting to IF’ey.