hapi-azure-msi-vault-plugin
v0.0.2
Published
A Hapi v18 azure msi vault plugin
Downloads
6
Readme
About hapi-azure-msi-vault-plugin
Tested successfully against Azure with Hapi v18.
Install:
npm install hapi-azure-msi-vault-plugin --save
Prerequistes:
Setup an Azure Vault:
https://azure.microsoft.com/en-us/resources/samples/key-vault-node-getting-started/
Usage:
'use strict';
const Hapi = require('@hapi/hapi');
const server = new Hapi.Server({
host: '0.0.0.0',
port: process.env.PORT || 1337
});
const startup = async () => {
await server.register([
{
plugin: require('hapi-azure-msi-vault-plugin'),
options: {
kvUri: 'https://<<YOUR VAULT HERE>>.vault.azure.net/'
}
}
]);
await server.start();
};
startup().catch((err) => {
throw err;
});
console.log(`${new Date()}: server running at ${server.info.uri}`);
How to fetch a secret:
server.app.vault('myAppSecret', 'myAppSecretVersion').then(secret => {
console.log('secret: ', secret)
});