Skip to content

conev-source-process-env is an implementation of conev's source to get configuration from process.env.

Notifications You must be signed in to change notification settings

CourseDesign/conev-source-process-env

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

conev-source-process-env

conev-source-process-env is an implementation of conev's source to get configuration from process.env.

Install

# with npm 
npm install conev-source-process-env
 
# or with Yarn 
yarn add conev-source-process-env

Usage

Get ConfigBuilder from conev and Sources to use.

import { ConfigBuilder } from 'conev';
import ProcessEnvSource from 'conev-source-process-env';

And create Source and set up.

const processEnvSource = new ProcessEnvSource(/* env */);

Create ConfigBuilder and set Environment, add source. (highest priority is added first).

const builder = new ConfigBuilder();

builder
    .setEnv('dev', 'basic')
    .addSource(processEnvSource);

Build configuration

const config = await builder.build(); // This is the result of combining dev and basic.

Use configuration

config.get() // The whole configuration created comes out
config.get('PATH'); // Is same as config.get().PATH

Process Env Source

class ProcessEnvSource {
    constructor(env?: string);
    export(): Promise<Map<string, object>>;
}

ProcessEnvSource defines the source from process.env. ​

Releases

No releases published

Packages

No packages published