Something like in [MongooseJS](http://mongoosejs.com/docs/api.html#index_Mongoose-createConnection) (please see examples given in the linked page): ``` javascript // lib/thoonk.js module.export = require('thoonk').createClient(); ``` ``` javascript // config/dev.js ... require('../lib/pubsub.js').open('localhost', '6379', 'dev'); ... // config/prod.js ... require('../lib/pubsub.js').open('prod.server', '6379', 'prod'); ... ``` And then, whenever we need thoonk, we can get it, fully ready just by requiring it: ``` javascript // app.js ... require('./config/' + process.env.NODE_ENV + '.js'); var thoonk = require('./lib/thoonk.js'); // ready-to-use! ... ```
Something like in MongooseJS (please see examples given in the linked page):
And then, whenever we need thoonk, we can get it, fully ready just by requiring it: