Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>After spending a while pursuing the script option I realised I should have been leveraging the Node module system and NPM to take care of all this for me. </p> <p>I ended up deleting the script and instead of the framework loading plugins from a plugin directory it now expects to be passed an array of plugins to load when it is instantiated, which has ended up making the whole thing quite trivial.</p> <p><strong>Framework/Server</strong></p> <pre><code>/** * Configures the Node.js Server. * @type {*} */ var _ = require('underscore'), express = require('express'), app = express(), port = process.env.PORT || 3003; module.exports = { /** * Starts the connector multi server. * @param {Object} options A hash of options to configure the multi server. * @param {Array} options.connectors An array of multi server connectors to load. */ start: function (options) { // Sanitize the options options = options || {connectors: []}; // Configure express console.log('Configuring express...'); require('./config/config.js')(app, express); require('./config/http-error.js'); // Load controllers console.log('Loading controllers...'); require('./controllers/appsecute.js')(app); require('./controllers/oauth2-client.js')(app); // Load connectors console.log('Loading connectors...'); _.each(options.connectors, function (connector) { connector(app); }); // Connectors have been loaded, start the multi server console.log('Finished loading connectors.'); console.log('Starting multi connector server...'); var express_app = app.listen(port); console.log("Multi connector server listening on port %d", port); return express_app; } }; </code></pre> <p><strong>Deployment Repo that pulls the framework + plugins together for deployment</strong></p> <pre><code>/** * A basic wrapper around the multi server that includes specific connector implementations ready for deployment. * * To add a new connector to the deployment: * 1. Add it as a dependency in package.json * 2. Pass it to the multi connector start() call. */ require('appsecute-connector-multi').server.start({ connectors: [ require('appsecute-connector-multi-heroku'), require('appsecute-connector-multi-tender'), require('appsecute-connector-multi-circleci'), require('appsecute-connector-multi-zendesk'), require('appsecute-connector-multi-github'), require('appsecute-connector-multi-travisci') ] }); </code></pre> <p>The advantage of doing it this way, asides from simplicity, is that because the framework and all the individual plugins are specified as dependencies in package.json in the deployment project NPM takes care of pulling down all co-dependencies, just as you would expect :)</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload