Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ludusrusso/env-ts-conf
Typed environment configuration for node
https://github.com/ludusrusso/env-ts-conf
Last synced: 20 days ago
JSON representation
Typed environment configuration for node
- Host: GitHub
- URL: https://github.com/ludusrusso/env-ts-conf
- Owner: ludusrusso
- Created: 2020-07-28T07:01:59.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-01-06T13:02:07.000Z (about 2 years ago)
- Last Synced: 2024-12-17T14:44:45.191Z (30 days ago)
- Language: TypeScript
- Size: 1.38 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# env-ts-conf
## Typed environment configuration for node
**env-ts-conf** is a simple library that provides types and autocompletion for configuration loaded from environment file.
### Usage
Install with `npm i env-ts-conf`!
Then define your configuration object with
```typescript
import { getConfigs } from 'env-ts-conf';const config = getConfigs({
test: {
type: 'string',
variableName: 'TEST_VARIABLE',
default: 'test',
},
myNumber: {
type: 'number',
variableName: 'MY_NUMBER',
default: 10,
},
});
```and you'll get back a typed object:
```ts
const config: {
test: string;
myNumber: number;
};
```![Example image](./img.png)
## Features
1. Simple to use
2. Configuration output is typed
3. Supports `number`, `string` and `boolean`
4. Supports default values,
5. Panic at starup if configuration is not found## Contribution
The library has been just released and is not jet super perfect. If you like
to help me improve it, feel free to submit an issue or a pull request!