Base configuration class that uses env-var and dotenv Usage:
class AppConfig extends BaseConfig { port = this.get('PORT').default(3000).asPortNumber()}const config = new AppConfig()console.log(config.port) // 3000
Env names can also be typed like this:
type Env = { PORT: string, HOST: string }class AppConfig extends BaseConfig<keyof Env> {}
or directly:
class AppConfig extends BaseConfig<'PORT' | 'HOST'> {}
Environmental variables source, if not specified defaults to process.env with dotenv
Usage:
port = this.get('PORT').default(3000).asPortNumber()
Generated using TypeDoc
Base configuration class that uses env-var and dotenv Usage:
Env names can also be typed like this:
or directly: