Is there an Apigee Vault Get sync function?

Not applicable

I'm trying to leverage Vault to retrieve the password stored in Vault to connect to a Postgres database. These connections are initialized in a database pool only when the API Proxy starts. So, in this case, it only needs to happen once, and would be reasonable to use synchronous functions. If trying to implement Node.js Modules using async functions, force the application to wire its initialization of Node.js modules with callbacks, which seem unnecessarily complex and overkill.

Is there a synchronous function for this use case? or am I missing anything? Maybe something similar to the first one below.

// proposed solution (sync)
var apigee = require('apigee-access');
var orgVault = apigee.getVault('vault1', 'organization');
var secretValue = orgVault.get('key1');

// currently supported (async)
var apigee = require('apigee-access');
var orgVault = apigee.getVault('vault1', 'organization');
orgVault.get('key1', function(err, secretValue) {
  // use the secret value here
}); 

Thanks!

Solved Solved
0 2 310
1 ACCEPTED SOLUTION

Not applicable
2 REPLIES 2

Not applicable

Hi @Diego Zuluaga, I don't think there is a sync way of using Apigee Vault as of now.

Here for more info: https://github.com/apigee/apigee-access/blob/78c2b730ee5379b67e921a3e00f0f0571ae27e44/lib/vault.js

Thanks @Maruti Chand for confirming. It'd be great to have the option of having a sync function because of the use case mentioned above. Maybe something to consider for a #HACKDAY 🙂

CC @Marsh Gardiner