Skip to content

Commit

Permalink
More cleaner, using older function
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre-Gilles committed Nov 9, 2015
1 parent 682dcbf commit b71aefd
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions api/services/ScriptService.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ function loadInSandbox (path, callback){
if(validFileName(file)){
file = file.substring(0,file.length-3);
sandbox[file] = global[file];
sails.log.info('Adding ' + file + ' to sandbox');
delete sandbox[file]['sails'];
}
}
Expand All @@ -72,20 +73,8 @@ function loadHooksServices (name, cb){
sails.log.info('Loading services in module ' + name);
sails.log.info('Scanning folder : ' + servicePath);

fs.readdir(servicePath, function (err, files) {
if(err) return cb(err);

for(var key in files){
var file = files[key];
if(validFileName(file)){
file = file.substring(0,file.length-3);
sandbox[file] = global[file];
sails.log.info('Adding service ' + file + ' to sandbox');
delete sandbox[file]['sails'];
}
}
cb(null);
});
// load in sandbox folder
loadInSandbox(servicePath, cb);
}


Expand Down

0 comments on commit b71aefd

Please sign in to comment.