Skip to content

Instantly share code, notes, and snippets.

@wolfeidau
Created January 27, 2013 22:26
Show Gist options
  • Select an option

  • Save wolfeidau/4650974 to your computer and use it in GitHub Desktop.

Select an option

Save wolfeidau/4650974 to your computer and use it in GitHub Desktop.
Error handling..
var fs = require('fs')
, path = require('path')
, errors = require('./errors')
exports.load = function(handleResult, configPath){
var path = configPath || "./.swagman.json" // note the optional configuration path
fs.readFile(path, function (err, data) {
handleResult(err, data)
})
}
exports.loadConfig = function(configPath, callback){
configPath = configPath || './.swagman.json'
return require(path.resolve(configPath))
}
exports.loadAwsConfiguration = function (configPath, callback) {
configPath = configPath || path.join(process.env.HOME, '.swagman_ec2.json')
return require(path.resolve(configPath))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment