[coldbox-5.1.1] New Router and AppMapping Issue

Hi Coldbox Team,

Today I upgraded from Coldbox 5.0 to 5.1.1 to discover that the whole routing mechanism has changed - which is a good thing and looks great.

But now I have a slight problem.

For some developers like myself do not want the Coldbox config folder (/config) at the same level as the application.

In my case my /config folder is located in a separate folder at root level to my /app/myapp/ folder also at root level e.g. /com/config/myapp/

For example my Application.cfc mappings would look like this:

// COM mappings
this.mappings[’/com’] = ExpandPath(’…/…/com/’);
this.mappings[’/app’] = ExpandPath(’…/…/apps/’);
// Application mappings
variables.coldbox_app_root_path = GetDirectoryFromPath(GetBaseTemplatePath());
variables.coldbox_app_mapping = ‘’;
variables.coldbox_config_file = ‘com.config.myapp.coldbox’;

And the Interceptor setting in the Coldbox config file allowed me to map where my Routes.cfm file was. But now this has been superseded in Coldbox 5.1.1.

interceptors = [ { class = “coldbox.system.interceptors.SES”, properties = { configFile="/com/config/myapp/routes.cfm" } } ];

The problem I have with the current implementation of Routes is the use of the controller.getSetting(‘AppMapping’);.

In most cases and in my case the COLDBOX_APP_MAPPING variable is left blank because we already know what the APP_ROOT_PATH is.

The problem being is that from line 40 of the RoutingService.cfc Coldbox file I am unable to define a custom location for my own Router.cfc file e.g. /com/config/myapp/Router.cfc.

I would have to:

  1. Move the config folder to the /app folder level e.g. /app/myapp/config
  2. or populate the COLDBOX_APP_MAPPING variable
    both of which I would like to avoid.

// Routing AppMapping Determinations
variables.appMapping = controller.getSetting( ‘AppMapping’ );
variables.routingAppMapping = ( len( controller.getSetting( ‘AppMapping’ ) lte 1 ) ? controller.getSetting( ‘AppMapping’ ) & “/” : “” );
variables.routingAppMapping = left( variables.routingAppMapping, 1 ) == “/” ? variables.routingAppMapping : “/#variables.routingAppMapping#”;

Just like the application.cfc COLDBOX_CONFIG_FILE variable:

  1. Couldn’t you define a new Coldbox application variable called e.g. COLDBOX_CONFIG_MAPPING or COLDBOX_CONFIG_ROUTES_MAPPING?
  2. Instead of using COLDBOX_APP_MAPPING (AppMapping) variable or used as a default.

Thanks!!!