Skip to content

Latest commit

 

History

History
30 lines (25 loc) · 510 Bytes

README.md

File metadata and controls

30 lines (25 loc) · 510 Bytes

config-decorator

PoC: simple config decorator with type casting, validation and env-driven out of the box

TL;DR

npm i config-decorator
import { Config, Nullable, Option } from 'config-decorator';

@Config('app')
export class AppConfig {
    @Option({
        type: 'number',
        default: 3000,
    })
    @Nullable()
    public readonly port!: number;
}

const appConfig = new AppConfig();
console.log(appConfig.port);
// 3000

Environment:

APP_PORT=3000