Socket
Book a DemoInstallSign in
Socket

@allohamora/config-manager

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@allohamora/config-manager

config manager

latest
Source
npmnpm
Version
0.9.0
Version published
Maintainers
1
Created
Source

Config-Manager

npm build test release

This package contains managers and utils for creating configs in a type-safe and stylish way.

Requirements

{
  "node": ">=18.14.0",
  "npm": ">=9.3.1"
}

Install

npm i @allohamora/config-manager

Usage

import { ConfigManager, EnvManager } from '@allohamora/config-manager';

const env = new EnvManager();
const config = new ConfigManager({
  getConfig: () => ({
    auth: {
      email: env.pick('AUTH_EMAIL').default('example@example.com').value(), // string
      password: env.get('AUTH_PASSWORD'), // string | undefined,
    },
  }),
});

config.getOrThrow('auth'); // { email: string, password?: string }
config.get('auth.email'); // string
config.get('auth.password'); // string | undefined
config.getOrThrow('auth.password'); // string or the validation error

Keywords

config

FAQs

Package last updated on 12 Sep 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts