Skip to content

Instantly share code, notes, and snippets.

@mikermcneil
Last active January 3, 2016 20:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikermcneil/8513795 to your computer and use it in GitHub Desktop.
Save mikermcneil/8513795 to your computer and use it in GitHub Desktop.
/* Kasper (18c98c26@gateway/web/freenode/ip.24.201.140.38) has joined #sailsjs
<Kasper> Hi there!
<Kasper> Anyone got time for a question?
<robdubya> nothing but time Kasper
<Kasper> Wonderful! It's related to Services: How would I access the Sails config when writing a service?
* sailsTroll (~nodebot@ec2-54-209-111-37.compute-1.amazonaws.com) has joined #sailsjs
<robdubya> ha Kasper, how prescient of you
*/
// api/services/FooService.js
module.exports = {
/**
* Some function that does stuff.
*
* @param {[type]} options [description]
* @param {Function} cb [description]
*/
lookupDumbledore: function(options, cb) {
// `sails` object is available here:
var conf = sails.config;
cb(null, conf.whatever);
}
};
// `sails` is not available here (it doesn't exist yet)
@lrdiv
Copy link

lrdiv commented Oct 9, 2014

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment