1.0.16 • Published 1 year ago

@hypercolor/envconfig v1.0.16

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

@hypercolor/envconfig

Table of Contents

Introduction

Use decorators to pull in configuration data from environment variables or volume mounts. Use the "fail fast" principle to ensure that all required variables are present before the application starts.

Adding the @requiredEnv or @optionalEnv decorator to a variable HOST_URL will do the following:

  • If process.env.HOST_URL is defined, use that value
  • If a volume mount is present at /etc/config/env/HOST_URL, use that value
  • If a volume mount is present at /etc/config/sec/HOST_URL, use that value
  • For @requiredEnv, if none of the above are present, throw an error

Installation

  • NPM
    • npm i @hypercolor/envconfig
  • Yarn
    • yarn add @hypercolor/envconfig

Usage

import {requiredEnv} from '@hypercolor/envconfig';

export class ConfigVariables {
  @requiredEnv() public ENVIRONMENT_NAME: string;
  @requiredJsonEnv() public SOME_PRIVATE_KEY_JSON: IPrivateKeyJson;
  @optionalEnv() public DEBUG?: string;
}

More Information

Project Repository

Organization Repository

1.0.16

1 year ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.15

2 years ago

1.0.14

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago