Skip to content

capira-0x/core-dotenv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

core-dotenv

styled with prettier

Base configuration class that uses env-var and dotenv

Installation:

npm i core-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'> {}

Bootstrapped with https://github.com/LuisReinoso/typescript-library-starter

About

No description, website, or topics provided.

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors