Reload policies
Hello,
During developement if you change policies, they arn't reloaded by the hook, do you think it would be possible to reload them ?
Thanks for your work
Also curious about this
It can't be as simple as sails.emit("hook:policies:reload"); in the index.js file can it?
Did you gave it a try ?
Reload responses would also be nice as I'm currently changing default responses to make easy server side rendering.
@sgress454 any clue on how to reload policies ?
I couldn't figure out how to reload the policies. I tried sails.emit("hook:policies:reload");, no go.
I even modified the source code from sails-hook-autoload, adding things like this in the sails.hooks.controllers.loadAndRegisterControllers() section:
// Reload policies
if (sails.hooks.policies) {
sails.hooks.policies.initialize(function() {
sails.hooks.policies.loadMiddleware(function() {
sails.hooks.policies.bindPolicies();
})
});
}
No dice. :-(
I just started using this hook and had the very same problem: "how can I reload config files other than policies.js?".
The thing is that whatever you put on config/autoreload.js inside a module.exports.autoreload key (as documentation says) does not make the trick. It turns out that, by default, the export has to be named module.exports['sails-hook-autoreload'] instead, as this.configKey at the hook defaults to sails-hook-autoreload.
Solution: Either you change the configKey value inside the hook or you change your module.exports key. I'll submit a PR soon with that.
@l1br3 @JHereu @tylercollier Thanks for using Sails! We've decided to end official support for this hook, as detailed in the end-of-life notice. If you're interested in taking over, please contact @sgress454.
So sad :( there is still so many downloads a day Thanks for this work on the hook, it's still very important for me. Which replacement solution do you use ?
@l1br3 I appreciate that, and if it works for you, by all means continue. As fas as replacements, the advent of SDD drives has personally made the ol' CTRL-C + sails lift combo a lot less painful for me, but this article has some good steps for getting forever to do live reload for you. Combining that with a local Redis store for persistent sessions and sockets should be a pretty good alternative to sails-hook-reload.
@sgress454 Does SDD stands for spite development driven ? Could I be add to the contributor list ? I don't want this hook to die since I'm able to use it as I want to.
@sgress454 thanks for the quick add to contributor list. I will try to keep this one alive