# env-var-base

> Base configuration class that uses env-var and dotenv

Latest version **1.4.0** (published 2022-10-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install env-var-base
pnpm add env-var-base
yarn add env-var-base
bun add env-var-base
```

## Health

**Score 35/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.4.0 |
| Published | 2022-10-28 |
| First published | 2021-03-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=14.0.0 |
| Dependencies | 0 |
| Unpacked size | 7.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | glebbash |
| Maintainers | glebbash |
| Keywords | config, env-var, dotenv, typescript |

## Links

- npm: https://www.npmjs.com/package/env-var-base
- Repository: https://github.com/glebbash/env-var-base
- Homepage: https://github.com/glebbash/env-var-base#readme
- Issues: https://github.com/glebbash/env-var-base/issues
- npm.io page: https://npm.io/package/env-var-base

## Alternatives

- [jsforce](https://npm.io/package/jsforce.md) — 851.2K weekly downloads
- [react-native-qrcode-svg](https://npm.io/package/react-native-qrcode-svg.md) — 693.5K weekly downloads
- [@salesforce/plugin-data](https://npm.io/package/@salesforce/plugin-data.md) — 394.9K weekly downloads
- [@backstage/plugin-search-common](https://npm.io/package/@backstage/plugin-search-common.md) — 308.5K weekly downloads
- [@chain-registry/types](https://npm.io/package/@chain-registry/types.md) — 38.4K weekly downloads

## Recent versions

- 1.4.0 (latest) — 2022-10-28
- 1.3.2 — 2022-05-26
- 1.3.1 — 2022-05-26
- 1.3.0 — 2021-11-17
- 1.2.1 — 2021-04-01
- 1.2.0 — 2021-04-01
- 1.1.1 — 2021-03-03
- 1.1.0 — 2021-03-03
- 1.0.0 — 2021-03-03

## README

# env-var-base

[![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
[![Coverage Status](https://coveralls.io/repos/github/glebbash/env-var-base/badge.svg?branch=master)](https://coveralls.io/github/glebbash/env-var-base?branch=master)

Base configuration class that uses
[env-var](https://github.com/evanshortiss/env-var)
and
[dotenv](https://github.com/motdotla/dotenv)

Installation:

```sh
npm i env-var-base
```

Usage:

```ts
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:

```ts
type Env = { PORT: string, HOST: string }

class AppConfig extends BaseConfig<keyof Env> {}
```

or directly:

```ts
class AppConfig extends BaseConfig<'PORT' | 'HOST'> {}
```

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

---
_Source: https://npm.io/package/env-var-base · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
