Load custom config setting from JSON file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void function afterConfigurationLoad(event,interceptData,buffer){ | |
//writeDump(controller.getConfigSettings()) | |
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]); | |
//log.info("Added environment secret #key# to settings"); | |
} | |
} | |
} | |
//writeDump(controller.getConfigSettings());abort; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment