Last active
December 23, 2015 05:49
-
-
Save kamiyam/6589335 to your computer and use it in GitHub Desktop.
sails service & config require manager
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function() { | |
var sails = global["sails"]; | |
if ( sails ){ | |
return sails.config; | |
} | |
else { | |
var app = require("../config/application"); | |
try { | |
var local = require("../config/local"); | |
var _ = require('underscore'); | |
app = _.extend( app, local ); | |
} catch( e ){} | |
return app; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function( target ) { | |
var sails = global["sails"]; | |
if ( sails ){ | |
return sails.service[target]; | |
} | |
else { | |
return require("../api/services/" + target ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment