Skip to content

Consul ​

Installation ​

bash
npm install @willsoto/node-konfig-consul
bash
yarn add @willsoto/node-konfig-consul
bash
bun add @willsoto/node-konfig-consul

Usage ​

typescript
import * as Konfig from "@willsoto/node-konfig-core";
import { ConsulLoader } from "@willsoto/node-konfig-consul";

const loader = new ConsulLoader({
  keys: [
    {
      key: "database",
      parser: new Konfig.JSONParser(),
    },
    {
      key: "appName",
    },
  ],
});

Check the documentation for consul for configuration options.

Options ​

NameRequiredDescription
keysyesAn array of keys to load. See Key for more information.
consulOptionsnoConsulOptions

Key ​

NameRequiredDescription
keyyesThe path to the secret in Consul.
getOptionsnoconsul.Kv.GetOptions