node-flipr
node-flipr copied to clipboard
Support for option resolvers
This would allow custom callbacks to be invoked to fetch the actual values asynchronously. Especially handy for secure options, or options stored in a central location.
Could look something like:
// dev.yaml
MySpecialKey:
resolver: my-special-resolver-module
// my-special-resolver-module.js
module.exports = function(key, originalValue, cb) {
// do something here to determine actual value
cb(null, actualValue);
};
And not that it would useful, but another side-effect of this feature would be to transform values (not sure why you'd do that, but seems an interesting possibility). Since the resolver has the original value (if values
is defined), it technically could compute/transform a different value as a result.
This is an interesting idea. I definitely like adding points of extensibility and this one seems to have value. You mentioned options stored in a central location: this seems more appropriate for a flipr source, more specifically the Etcd source (refactor in progress). Using this for sensitive config data is a perfect use case though (the ability to decrypt something stored encrypted in a flipr source).
Cool, looking forward to the refactor.