Skip to content

Instantly share code, notes, and snippets.

Created July 13, 2016 17:48
What would you like to do?
Load custom config setting from JSON file
void function afterConfigurationLoad(event,interceptData,buffer){
var basePath = getDirectoryFromPath(getCurrentTemplatePath());
/* Check for custom configuration file. This should be ignrored */
if (fileExists("#basePath#/CustomConfig.json.cfm")) {
var settingsJSON = fileRead("#basePath#/CustomConfig.json.cfm");
/* File should be valid json */
if (isJSON(settingsJSON)) {
var customSettings = deserializeJSON(settingsJSON);
/* Append/overrite current settings */
for (var key in customSettings) {
controller.setSetting(key, customSettings[key]);
//"Added environment secret #key# to settings");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment