npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@biorate/config-loader-vault

v2.1.4

Published

Config loader for vault config

Readme

@biorate/config-loader-vault

Config loader for HashiCorp Vault — reads secrets from Vault and merges into IConfig or downloads to filesystem with caching.

Features

  • Two actionsmerge (load into config tree) and download (write files to disk).
  • Vault caching — optionally cache Vault responses as JSON on disk to reduce API calls.
  • Config-driven — options read from IConfig under the class name key.
  • Error resilience — per-option required flag controls whether failure is fatal.
  • DI-ready — extends ConfigLoader, injects IVaultConnector.

Installation

pnpm add @biorate/config-loader-vault

Requires @biorate/config, @biorate/config-loader, @biorate/errors, @biorate/inversion, @biorate/tools, @biorate/vault.

Quick start

import { inject, container, Types, Core } from '@biorate/inversion';
import { IConfig, Config } from '@biorate/config';
import { ConfigLoaderVault, ConfigLoaderVaultActions } from '@biorate/config-loader-vault';
import { VaultConnector } from '@biorate/vault';

class Root extends Core() {
  @inject(Types.Config) public config: IConfig;
  @inject(ConfigLoaderVault) public loader: ConfigLoaderVault;
}

container.bind<IConfig>(Types.Config).to(Config).inSingletonScope();
container.bind<VaultConnector>(VaultConnector).toSelf().inSingletonScope();
container.bind<ConfigLoaderVault>(ConfigLoaderVault).toSelf().inSingletonScope();

container.get<IConfig>(Types.Config).merge({
  Vault: [{ name: 'primary', options: { baseURL: 'http://localhost:8200', token: 'root' } }],
  ConfigLoaderVault: [
    { action: ConfigLoaderVaultActions.Merge, path: 'secret/data/config', connection: 'primary', cache: true },
  ],
});

(async () => {
  const root = container.get<Root>(Root);
  await root.$run();
  console.log(root.config.get('my-secret-key'));
})();

Module reference

ConfigLoaderVault — Main class

import { ConfigLoaderVault } from '@biorate/config-loader-vault';

Extends ConfigLoader (from @biorate/config-loader).

| Member | Visibility | Signature | Description | |---------------------|---------------|------------------------------------------------|-----------------------------------| | vault | protected readonly | IVaultConnector | Injected Vault connector. | | initialize | @init() protected | (): Promise<void> | Read options from config, execute actions. | | read | protected | (option): Promise<Record<string, unknown>> | Read from cache or Vault. | | cache | protected | (option, data): Promise<void> | Write JSON cache file. | | [Merge] | protected | (data, option): Promise<void> | Merge data into config. | | [Download] | protected | (data, option): Promise<void> | Merge + write files to disk. |

ConfigLoaderVaultActions — Enum

enum ConfigLoaderVaultActions {
  Merge = 'merge',
  Download = 'download',
}

IConfigLoaderVaultOption — Option type

type IConfigLoaderVaultOption = {
  action: ConfigLoaderVaultActions;
  path: string;                             // Vault secret path
  connection: string;                       // Named Vault connection
  cache?: boolean;                          // Enable JSON cache (default false)
  directory?: string;                       // Download directory (default 'downloads')
  required?: boolean;                       // Fail on error (default true)
};

Errors

| Error | Condition | |----------------------------------------|---------------------------------------| | ConfigLoaderVaultUnknownCacheError | Filesystem error during cache write (logged as warn). |

Actions

Merge

Reads JSON from Vault and calls this.config.merge(data). The data becomes available in the central config tree.

Download

Calls config.merge(data), then for each key in data writes a file: cwd/{directory}/{key} with the stringified value.

Architecture

ConfigLoaderVault extends ConfigLoader (@injectable)
│
├── @inject(Types.Vault) vault
│
└── @init() initialize()
    └── for each option in config.get('ConfigLoaderVault', [])
        ├── read(option)
        │   ├── if option.cache and cache file exists → return cached
        │   └── vault.connection(option.connection).read(option.path) → cache if enabled
        │
        └── switch (option.action)
            ├── Merge    → this.config.merge(data)
            └── Download → this.config.merge(data) + fs.writeFile for each key

Learn

  • Documentation can be found here - docs.

Release History

See the CHANGELOG

License

MIT

Copyright (c) 2021-present Leonid Levkin (llevkin)