What do I need to configure in LightFront? Where? How?
Where is the easy one, so we'll discuss that first. Everything you need to configure is in Application.cfc. LightFront doesn't have much to configure, but there are a few required things to config, and many more that are optional.
Everything you need to configure is located in the setCustomLightFrontSettings() function, located at the bottom of Application.cfc.
Required settings by LightFront (with defaults)
Though there are a fair number of settings that need to be set, every required setting has a default. Essentially, you only have to set a required setting if you don't follow its convention.
- application.lfront.settings.startupTimeout - How long you'll give LightFront to startup. LightFront's very small and lightweight, so it doesn't need a lot of time to start up by itself, but your model might... so the setting you'll see in Application.cfc is a conservative 60 seconds.
- Your action structure, defined by the actionVariable, consists of: A controller, an action delimiter, and a action. For controller and action, you must define defaults, and LightFront does not define a default for you.
- application.lfront.settings.actionVariable - This is how you call an action, such as /?do=home.welcome. "do" is the default name for this variable, but it can be anything you see fit, such as: action, go, fuseaction, page or action.
- application.lfront.settings.defaultController - controller is the first part of your action, before the actionDelimiter. When hitting LightFront without a controller defined, the default controller will be added. If the action only has one element, the default controller will be added to the action. In this example, home is the default controller.
- application.lfront.settings.actionDelimiter - The separator in the action between controller and action. The default is "." but other examples you could define are ":", "," or "_".
- application.lfront.settings.defaultAction - This is the default action that LightFront will use if one is not defined in the request. You may choose "default" or something else. In this sample application, welcome is the default. "default" is the default.
- application.lfront.settings.reload & application.lfront.settings.reloadpassword - Used to reload the application. In the sample application, reload is set to reload, and password is set to true. To restart the application, you would call /?reload=true. Try it!
- application.lfront.settings.cfcControllerDirectory - LightFront assumes you will be using CFC-based controllers. Whether you use them or not, you must define a valid directory (one that exists). That directory can have no files in it, but any .cfc files will be initialized by the framework. Keep all of your controller CFCs in this folder, and do not put CFCs in any subfolders (default: /controller/).
- application.lfront.settings.viewDirectory - Your views must all be contained in a viewDirectory. Unlike your CFC controllers, your views can exist nested in subfolders. However, make sure there's a common view directory. (Note: It is possible to get around this issue with virtual directories/aliases and ColdFusion mappings, but why not keep it simple? by just containing a simple common views directory? Trust me... you'll thank me later!)
- application.lfront.settings.applicationMode - Development, Testing, Staging or Production. Default is Development.
Optional settings by LightFront (not required to be defined):
- application.lfront.settings.preAction - Typical uses for a preAction are if you need to check for a login, or if generating a header.
- application.lfront.settings.postAction - Typical uses for a postAction are to wrap a layout around the output, or if you need to generate nested layouts. If you have an application that is used for Ajax as well as typical applications, you may want to pass a different request variable for Ajax requests, and check for the existence of that variable in your layout, and don't display it in that case.
- application.lfront.settings.controllerPrefix - If you need to save the controllers with a prefix, use this setting. eg. prefix = "act_": application.lfront.settings.controllerPrefix = "act_"; In this case, LightFront would look for controllers in the pattern of act_{controllerName}.cfc.
- application.lfront.settings.controllerSuffix - Similar to above, but with a suffix. eg. suffix = "Controller": application.lfront.settings.controllerSuffix = "Controller"; In this case, LightFront would look for controllers in the pattern of {controllerName}Controller.cfc.
- application.lfront.settings.servicePrefix - If you need to save the services with a prefix, use this setting. eg. prefix = "obj": application.lfront.settings.servicePrefix = "obj"; In this case, LightFront would look for services in the pattern of obj{controllerName}.cfc.
- application.lfront.settings.serviceSuffix - Similar to above, but with a suffix. eg. suffix = "Service": application.lfront.settings.serviceSuffix = "Service"; In this case, LightFront would look for services in the pattern of {controllerName}Service.cfc. Note: This is used in this sample application. Check this in Application.cfc for the example.
- application.lfront.settings.assignments - Assignments are used if you want to assign a controller to another controller referenced in the URL. You might use this if you need a short form of the actual controller name, or if you want to let one controller do multiple functions, such as seen in the example for the CFObjective 2010 presentation. For example, if you want to setup the "admin" assignment for admin actions, pointing to main.cfc.
- application.lfront.settings.switch - If you plan to use switch-style controllers in your application, you will need to set up the switch information in your application. You can find an example of this within this sample application.
