npm.io
1.0.1 • Published 5 years ago

env-ts-conf

Licence
ISC
Version
1.0.1
Deps
0
Size
72 kB
Vulns
0
Weekly
0
Stars
1

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!