0.2.1 • Published 7 months ago

@rytass/secret-adapter-vault v0.2.1

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

Rytass Utils - Secret Manager (Vault)

Featues

Auth

  • Vault Auth (userpass)
  • Vault Auth (token)

Engines

Getting Started

import { VaultSecret } from '@rytass/secret-adapter-vault';

const offlineManager = new VaultSecret('rytass/utils', {
  host: 'https://vault.server.com',
  auth: {
    account: 'account',
    password: 'complex_text',
  },
  onReady: () => {
    const dbHost = offlineManager.get<string>('DB_HOST');

    offlineManager.set<string>('NEW_KEY', 'BAR');

    const newKey = offlineManager.get<string>('NEW_KEY'); // BAR

    offlineManager.delete('NEW_KEY');

    offlineManager.sync().then(() => {
      // Synced local cache to server
    });

    // Force replace online data (ignore version check)
    offlineManager.sync(true);
  },
});

const onlineManager = new VaultSecret('rytass/utils', {
  host: 'https://vault.server.com',
  online: true,
  auth: {
    account: 'account',
    password: 'complex_text',
  },
});

const dbUser = await onlineManager.get<string>('DB_USER');

await onlineManager.set<number>('USAGE_COUNT', 6);

const usage = await onlineManager.get<number>('USAGE_COUNT');

await onlineManager.delete('USAGE_COUNT');
0.2.1

7 months ago

0.2.0

12 months ago

0.1.0

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago