Created
August 27, 2011 00:35
-
-
Save aarongreenlee/1174783 to your computer and use it in GitHub Desktop.
ColdBox Environment Detection Interceptor that ensures proper environment
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** Ensure the proper environment regardless of domain used to construct the app **/ | |
component { | |
// PUBLIC METHODS --------------------------------------------------------------- | |
public void function configure(){ | |
// You don't have to put this in the application scope. | |
// I just like to keep it there. | |
application.machine | |
= createObject('java','java.net.InetAddress').getLocalHost().getHostName(); | |
switch(application.machine) | |
{ | |
case 'somemachine' : | |
local.env = "workstation" | |
break; | |
case 'some_other_machine' : | |
local.env = "dev" | |
break; | |
case 'machine_name_45' : | |
local.env = "CIServer" | |
break; | |
case 'machine_name_x' : | |
default: | |
local.env = "production" | |
break; | |
} | |
variables.Controller.SetSetting('Environment',local.env); | |
return; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment