1.1.0 • Published 5 years ago

typenv v1.1.0

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

Typenv intends to provide .env configuration with type safety in mind.

Installation

Using yarn

yarn add typenv

Using npm

npm i typenv

Usage

Documentation

Quick Start

.env

DB_HOST=192.168.1.1
DB_PORT=1234

src/database_config.ts

import { load, loadSync, Key } from "typenv"; 

class DatabaseConfig { @Key("DB_HOST", "localhost") public hostname: string;

@Key("DB_PORT", 5432) public port: number; }

const config = await load(DatabaseConfig); // or const config = loadSync(DatabaseConfig);

console.log(config.hostname); // > "192.168.1.1" console.log(config.port); // > 1234

### Configuration
Environment variables
* `DOTENV_CONFIG_PATH` - Location of `.env` file (defaults to `$CWD`)

## Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what 
you would like to change.

Please make sure to update tests as appropriate.

## License
[MIT](LICENSE.md)
1.1.0

5 years ago

1.0.0

5 years ago

0.0.16

5 years ago

0.0.17

5 years ago

0.0.12

5 years ago

0.0.15

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago