1.0.1 • Published 4 years ago

env-ts-conf v1.0.1

Weekly downloads
11
License
ISC
Repository
github
Last release
4 years ago

env-ts-conf

Typed environment configuration for node

env-ts-conf is a simple library that provides types and autocompletion for configuration loaded from environment file.

You start from a configuration object describing the environment variabiles you want to load

const config = getConfigs({
  test: {
    type: 'string',
    variableName: 'TEST_VARIABLE',
    default: 'test',
  },
  myNumber: {
    type: 'number',
    variableName: 'MY_NUMBER',
    default: 10,
  },
});

and you get back a typed object:

const conf: {
  test: string;
  myNumber: number;
};

Example image

Features

  • typed configuration and autocompletion!
  • crashes if env variable is not found!