frontend-config-scope
TypeScript icon, indicating that this package has built-in type declarations

2.0.0 • Public • Published

frontend-config-scope

NPM Version Build Status Coverage Status

Config management for the frontend

Basic example

import { ConfigScope } from 'frontend-config-scope'

const envVars = {
  ...import.meta.env,
}

const config = new ConfigScope(envVars)

export const SOME_API_URL = config.getMandatory('API_URL') // this will throw an error if not set
export const BUGSNAG_API_KEY = config.getOptional('VITE_BUGSNAG_API_KEY', '') // this will use default value if not set
export const ENV = config.getMandatoryOneOf('VITE_ENV', ['local', 'development', 'production']) // this will throw an error if not one of the supported values

Dependencies (0)

    Dev Dependencies (16)

    Package Sidebar

    Install

    npm i frontend-config-scope

    Weekly Downloads

    435

    Version

    2.0.0

    License

    Apache-2.0

    Unpacked Size

    9.22 kB

    Total Files

    9

    Last publish

    Collaborators

    • kibertoad