Skip to content

Instantly share code, notes, and snippets.

@robertz
Created April 3, 2017 19:00
Show Gist options
  • Save robertz/e9148deef34de8ed4ed2ef7e2274c352 to your computer and use it in GitHub Desktop.
Save robertz/e9148deef34de8ed4ed2ef7e2274c352 to your computer and use it in GitHub Desktop.
component{
// Configure ColdBox Application
function configure(){
// coldbox directives
coldbox = {
//Application Setup
appName = "Appname",
eventName = "event",
//Development Settings
reinitPassword = "local",
handlersIndexAutoReload = true,
//Implicit Events
defaultEvent = "",
requestStartHandler = "Main.onRequestStart",
requestEndHandler = "",
applicationStartHandler = "Main.onAppInit",
applicationEndHandler = "",
sessionStartHandler = "",
sessionEndHandler = "",
missingTemplateHandler = "",
//Extension Points
applicationHelper = "includes/helpers/ApplicationHelper.cfm",
viewsHelper = "",
modulesExternalLocation = [ "modules_app" ],
viewsExternalLocation = "",
layoutsExternalLocation = "",
handlersExternalLocation = "",
requestContextDecorator = "models.RequestContextDecorator",
controllerDecorator = "",
//Error/Exception Handling
invalidHTTPMethodHandler = "",
exceptionHandler = "main.onException",
onInvalidEvent = "Home.pageNotFound",
customErrorTemplate = "",
//Application Aspects
handlerCaching = false,
eventCaching = false,
viewCaching = false
};
// custom settings
settings = {
defaultMemberGUID: '0b60bad6-e265-11e6-a22c-887cd6bc2ca7'
};
// mail settings
mailsettings = {
// The default token Marker Symbol
tokenMarker = "@",
// protocol
protocol = {
class = "cbmailservices.models.protocols.CFMailProtocol",
properties = {}
}
};
// environment settings, create a detectEnvironment() method to detect it yourself.
// create a function with the name of the environment so it can be executed if that environment is detected
// the value of the environment is a list of regex patterns to match the cgi.http_host.
environments = {
development = "localhost,^127\.0\.0\.1",
production = "domain.com"
};
// Module Directives
modules = {
//Turn to false in production
autoReload = false,
// An array of modules names to load, empty means all of them
include = [],
// An array of modules names to NOT load, empty means none
exclude = []
};
//LogBox DSL
logBox = {
// Define Appenders
appenders = {
coldboxTracer = { class="coldbox.system.logging.appenders.ConsoleAppender" }
},
// Root Logger
root = { levelmax="INFO", appenders="*" },
// Implicit Level Categories
info = [ "coldbox.system" ]
};
//Layout Settings
layoutSettings = {
defaultLayout = "",
defaultView = ""
};
//Interceptor Settings
interceptorSettings = {
throwOnInvalidStates = false,
customInterceptionPoints = ""
};
//Register interceptors as an array, we need order
interceptors = [
//SES
{class="coldbox.system.interceptors.SES",
properties={}
}
];
/*
// module setting overrides
moduleSettings = {
moduleName = {
settingName = "overrideValue"
}
};
// flash scope configuration
flash = {
scope = "session,client,cluster,ColdboxCache,or full path",
properties = {}, // constructor properties for the flash scope implementation
inflateToRC = true, // automatically inflate flash data into the RC scope
inflateToPRC = false, // automatically inflate flash data into the PRC scope
autoPurge = true, // automatically purge flash data for you
autoSave = true // automatically save flash scopes at end of a request and on relocations.
};
//Register Layouts
layouts = [
{ name = "login",
file = "Layout.tester.cfm",
views = "vwLogin,test",
folders = "tags,pdf/single"
}
];
//Conventions
conventions = {
handlersLocation = "handlers",
viewsLocation = "views",
layoutsLocation = "layouts",
modelsLocation = "models",
eventAction = "index"
};
//Datasources
datasources = {
mysite = {name="mySite", dbType="mysql", username="root", password="pass"},
blog_dsn = {name="myBlog", dbType="oracle", username="root", password="pass"}
};
*/
}
/**
* Development environment
*/
function development(){
coldbox.customErrorTemplate = "/coldbox/system/includes/BugReport.cfm";
coldbox.baseURL = "http://localhost:8080/index.cfm";
coldbox.isProduction = false;
}
/**
* Production environment
*/
function production(){
coldbox.baseURL = "https://domain.com/";
coldbox.isProduction = true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment