Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot disable sockets hook when deps are installed with npm 3 #3317

Closed
robertrossmann opened this issue Oct 21, 2015 · 4 comments
Closed

Cannot disable sockets hook when deps are installed with npm 3 #3317

robertrossmann opened this issue Oct 21, 2015 · 4 comments
Labels

Comments

@robertrossmann
Copy link
Contributor

The sockets hook is documented to be disable-able via a .sailsrc file. However, if the project dependencies are installed with npm 3, they are flattened into the project's node_modules folder. This causes Sails to detect it as a user hook (because it has a "isHook": true in its package.json) and load it anyway.

I have not checked in much detail how the hook loading works, but it seems core hooks are loaded independently of user hooks. A solution might be to treat them all equal - i.e. get the list of core hooks, get the list of user hooks, apply configuration from .sailsrc and load them.

As a nice side-effect, we would be able to disable installed user hooks via .sailsrc.

@tjwebb tjwebb added the bug label Oct 24, 2015
@tjwebb
Copy link
Contributor

tjwebb commented Oct 25, 2015

I think this is resolved in #3276

@tjwebb tjwebb closed this as completed Oct 25, 2015
@alexisbrtl
Copy link

The issue has been resolved on master (0.12.x I believe), but is there any plan to resolve it on stable (0.11.x) ?

EDIT: Just tried with 0.12.0-rc4, disabling the sockets hook didn't work... I'll just go back to node 4 for now.

@levity
Copy link

levity commented Feb 2, 2016

Looks like the fix didn't make it in until 0.12.0-rc5.

@dcolley
Copy link

dcolley commented May 5, 2017

For me "pubsub":false,"sockets":false in .sailsrc or sails/hooks.js is not working.

sails v0.12.13, node v7.4.0.

I simply added this to config/sockets.js

beforeConnect: function(handshake, cb) {
  return cb('socket connections not allowed!', false);
},

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

No branches or pull requests

5 participants