Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- component {
- function init(required string configFile) {
- variables.configFile = arguments.configFile;
- variables.loadSections = ["common", CGI.SERVER_NAME];
- return getConfig();
- }
- private function getConfig() {
- var config = StructNew();
- var sections = getProfileSections(variables.configFile);
- // Load settings applicable to this environment
- for(var i=1; i LTE ArrayLen(variables.loadSections); i++) {
- var currentSection = variables.loadSections[i];
- // Verify section exists
- if (StructKeyExists(sections, currentSection)) {
- var keyList = sections[currentSection];
- for(var j=1; j LTE ListLen(keyList); j++) {
- var currentKey = ListGetAt(keyList, j);
- var currentKeyValue = GetProfileString(variables.configFile, currentSection, currentKey);
- // Append setting (overwrite common settings if a server-specific value exists)
- StructInsert(config, currentKey, currentKeyValue, True);
- }
- }
- }
- return config;
- }
- }
Add Comment
Please, Sign In to add comment