nl_tokens: Start given plugin ( require it run configuration and apply change to cozy light server ) . NB : Do not load given plugin if it is disabled .
pl_tokens: function ( pluginName , program , applicationServer , callback ) { var config = configHelpers . getConfig ( ) ; // Test if plugin is installed. if ( config . plugins [ pluginName ] === undefined ) { logger . error ( 'Plugin ' + pluginName + ' not installed!' ) ; nodeHelpers . invoke ( <mask> ) ; } else { try { // Load plugin if ( pluginHelpers . loadedPlugins [ pluginName ] === undefined ) { pluginHelpers . loadPlugin ( pluginName , program ) ; } var plugin = pluginHelpers . loadedPlugins [ pluginName ] ; if ( plugin !== null ) { pluginHelpers . startedPlugins [ plugin ] = true ; if ( plugin . configureAppServer && applicationServer ) { logger . info ( 'Configuring plugin ' + pluginName + '...' ) ; plugin . configureAppServer ( applicationServer , config , routes , function logResult ( ) { logger . info ( 'Plugin ' + pluginName + ' configured.' ) ; nodeHelpers . invoke ( callback ) ; } ) ; // Plugin has no action to perform on the server. } else { nodeHelpers . invoke ( callback ) ; } // Something went wrong while loading the plugin. } else { logger . error ( 'Plugin ' + pluginName + ' was not properly loaded!' ) ; nodeHelpers . invoke ( callback ) ; } } catch ( err ) { logger . raw ( err ) ; logger . error ( 'Plugin ' + pluginName + ' loading failed.' ) ; nodeHelpers . invoke ( callback , err ) ; } } }