node-flipr icon indicating copy to clipboard operation
node-flipr copied to clipboard

Support for option resolvers

Open asilvas opened this issue 10 years ago • 2 comments

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.

asilvas avatar Dec 17 '14 18:12 asilvas

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).

gshively11 avatar Dec 17 '14 19:12 gshively11

Cool, looking forward to the refactor.

asilvas avatar Dec 18 '14 00:12 asilvas