FORGEBOX Enterprise 🚀 - Take your ColdFusion (CFML) Development to Modern Times! Learn More...

Maintenance Mode

v1 Public
This interceptor places the specified coldbox app or set of events based on the JSON rules file in maintenance mode by just updating the rulesFile and reinitiating the coldbox application.



Install:
 1. Drop the maintenance.cfc interceptor in to interceptor directory.
 2. Drop the maintenanceSchema.json.cfm in to your coldbox config directory.
 3. Write up a maintenance.json.cfm and drop it into your config directory.

Declaring the Interceptor:

Maintenance interceptor should be declared first or after deploy interceptor in the interceptor array queue since we don't want to run any other interceptor when the application itself is in maintenance mode. This interceptor also ends the interceptor chain if in maintenance mode.

{class="modulessample.interceptors.maintenance",properties = {rulesFile="config/maintenance.json.cfm",useregex=true}}

Properties:
Property Type Required Default Description
useRegex Boolean false true Enables Regular expression pattern matching.
rulesSchemaFile String false config/maintenanceSchema.json.cfm Location of the Json rules schema file which will be used to validate the Json rules file.
rulesFile String True -- Location of the Json maintenance rules file.
Rules:
The rules file content is formated in full JSON format which needs to validate against the below Rules Schema.

{
   "type":"struct",
   "items":{
      "maintenanceModeEnabled":{//set to true and reintialize the framework to place the below patterns in maintenance mode.
         "type":"boolean",
         "required": "true"
      },
      "rules":{
         "type":"array",
         "keys":{
            "type":"struct",
            "items":{
               "eventPattern":{ // is a list of events or if useRegex is set to true then it can be list of Regular expressions
                  "type":"string",
                  "required":"true"
               },
               "redirectURI":{ // Needs to be a valid URI and takes precendence over overrieEvent
                  "type":"string",
                  "required":"false"
               },
               "overrideEvent":{ // this event will over ride any incoming event.
                  "type":"string",
                  "required":"false"
               }              
            }
         }
      }
   }
}

E.g Rules File:
{
   "maintenanceModeEnabled":"false",
   "rules":[
      {
         "eventPattern":"^general",
         "redirectURI":"http://www.google.com"
      },
      {
         "eventPattern":"^remote",
         "overrideEvent":"maintenance.remotemessage"
      }     
   ]
}

Here are all the versions for this package. Please note that you can leverage CommandBox package versioning to install any package you like. Please refer to our managing package version guide for more information.

Version Created Last Update Published By Stable Actions
Current
1 Sep 18 2011 10:34 PM Jun 09 2016 01:20 AM

 

No collaborators yet.
 
4.00 / 2
  • Sep 18 2011 10:34 PM
  • Jun 09 2016 01:20 AM
  • 3,386
  • 1,575
  • 2