/
Coldbox.cfc
267 lines (232 loc) · 6.39 KB
/
Coldbox.cfc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
<cfcomponent output="false" hint="My App Configuration">
<cfscript>
/**
structures/arrays to create for configuration
- coldbox (struct)
- settings (struct)
- conventions (struct)
- environments (struct)
- wirebox (struct)
- ioc (struct)
- debugger (struct)
- mailSettings (struct)
- i18n (struct)
- webservices (struct)
- datasources (struct)
- layoutSettings (struct)
- layouts (array of structs)
- cacheBox (struct)
- interceptorSettings (struct)
- interceptors (array of structs)
- modules (struct)
- logBox (struct)
- flash (struct)
- orm (struct)
- validation (struct)
Available objects in variable scope
- controller
- logBoxConfig
- appMapping (auto calculated by ColdBox)
Required Methods
- configure() : The method ColdBox calls to configure the application.
Optional Methods
- detectEnvironment() : If declared the framework will call it and it must return the name of the environment you are on.
- {environment}() : The name of the environment found and called by the framework.
*/
// Configure ColdBox Application
function configure(){
// coldbox directives
coldbox = {
//Application Setup
appName = "Your app name here",
eventName = "event",
//Development Settings
debugMode = true,
debugPassword = "",
reinitPassword = "",
handlersIndexAutoReload = true,
//Implicit Events
defaultEvent = "General.index",
requestStartHandler = "Main.onRequestStart",
requestEndHandler = "",
applicationStartHandler = "Main.onAppInit",
applicationEndHandler = "",
sessionStartHandler = "",
sessionEndHandler = "",
missingTemplateHandler = "",
//Extension Points
UDFLibraryFile = "includes/helpers/ApplicationHelper.cfm",
coldboxExtensionsLocation = "",
modulesExternalLocation = [],
pluginsExternalLocation = "",
viewsExternalLocation = "",
layoutsExternalLocation = "",
handlersExternalLocation = "",
requestContextDecorator = "",
//Error/Exception Handling
exceptionHandler = "",
onInvalidEvent = "",
customErrorTemplate = "",
//Application Aspects
handlerCaching = false,
eventCaching = false,
proxyReturnCollection = false
};
// custom settings
settings = {
};
// 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 = "^cf8.,^railo."
};
// 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.ColdboxTracerAppender" }
},
// Root Logger
root = { levelmax="INFO", appenders="*" },
// Implicit Level Categories
info = [ "coldbox.system" ]
};
//Layout Settings
layoutSettings = {
defaultLayout = "Layout.Main.cfm",
defaultView = ""
};
//WireBox Integration
wireBox = {
enabled = true,
//binder="config.WireBox",
singletonReload=true
};
//Interceptor Settings
interceptorSettings = {
throwOnInvalidStates = false,
customInterceptionPoints = ""
};
//Register interceptors as an array, we need order
interceptors = [
//SES
{class="coldbox.system.interceptors.SES",
properties={}
}
];
// Object & Form Validation
validation = {
// manager = "class path" or none at all to use ColdBox as the validation manager
// The shared constraints for your application.
sharedConstraints = {
// EX
// myForm = { name={required=true}, age={type="numeric",min="18"} }
}
};
/*
// ORM services, injection, etc
orm = {
// entity injection
injection = {
// enable it
enabled = true,
// the include list for injection
include = "",
// the exclude list for injection
exclude = ""
}
};
// 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",
pluginsLocation = "plugins",
viewsLocation = "views",
layoutsLocation = "layouts",
modelsLocation = "model",
eventAction = "index"
};
//IOC Integration
ioc = {
framework = "lightwire",
reload = true,
objectCaching = false,
definitionFile = "config/coldspring.xml.cfm",
parentFactory = {
framework = "coldspring",
definitionFile = "config/parent.xml.cfm"
}
};
//Debugger Settings
debugger = {
enableDumpVar = false,
persistentRequestProfilers = true,
maxPersistentRequestProfilers = 10,
maxRCPanelQueryRows = 50,
showRCSnapshots = false,
//Panels
showTracerPanel = true,
expandedTracerPanel = true,
showInfoPanel = true,
expandedInfoPanel = true,
showCachePanel = true,
expandedCachePanel = true,
showRCPanel = true,
expandedRCPanel = true,
showModulesPanel = true,
expandedModulesPanel = false
};
//Mailsettings
mailSettings = {
server = "",
username = "",
password = "",
port = 25
};
//i18n & Localization
i18n = {
defaultResourceBundle = "includes/i18n/main",
defaultLocale = "en_US",
localeStorage = "session",
unknownTranslation = "**NOT FOUND**"
};
//webservices
webservices = {
testWS = "http://www.test.com/test.cfc?wsdl",
AnotherTestWS = "http://www.coldbox.org/distribution/updatews.cfc?wsdl"
};
//Datasources
datasources = {
mysite = {name="mySite", dbType="mysql", username="root", password="pass"},
blog_dsn = {name="myBlog", dbType="oracle", username="root", password="pass"}
};
*/
}
</cfscript>
</cfcomponent>