[coldbox:4171] setBaseURL(); per environment?

is it possible to set different BaseURL's based on environment?

yes, you will have to intercept at preProcess() and override the base URL for that request via the event request context object:


You can also look at forgebox, there is already a multi domain interceptor there.

Luis F. Majano
Ortus Solutions, Corp

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

I am not sure that I follow can you post an example?

is it like this
function development(){



i can't get my sample-app running on coldbox 3 m5, when placing it
in a different root folder ... :

webroot example

approot example

i tried all kind of settings in Application.cfc with relative & absolute paths
and coldfusion-mappings.

last setting says "can't find modules.forgebox.ModuleConfig".
or Error Messages: invalid component definition, can't find handlers.Main

my settings:
<cfset COLDBOX_APP_ROOT_PATH = '/webdata/domain.com/htdocs/db-app/'>
<cfset COLDBOX_CONFIG_FILE = "/db-app/config/Coldbox.cfc"> (with a cf-mapping on /db-app)

i also tried the other way around without success:
webroot example

approot example

running the APP in "normal" folder-structure works correct and painless.



Like this in an interceptor:

  <cffunction name="preProcess" access="public" returntype="void"
hint="Executes before any event execution occurs" output="false" >
    <cfargument name="event">
    <cfargument name="interceptData">
      // set the base URL according to domain or whatever strategy you like.
      arguments.event.setSESBaseURL("http://" & cgi.http_host & "/index.cfm");