Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/petrgrishin/config-decorator
PoC: simple config decorator with type casting, validation and env-driven out of the box
https://github.com/petrgrishin/config-decorator
config decorator dotenv env poc
Last synced: 6 days ago
JSON representation
PoC: simple config decorator with type casting, validation and env-driven out of the box
- Host: GitHub
- URL: https://github.com/petrgrishin/config-decorator
- Owner: petrgrishin
- Created: 2022-10-18T17:26:45.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2024-06-23T07:59:57.000Z (5 months ago)
- Last Synced: 2024-06-23T08:39:51.498Z (5 months ago)
- Topics: config, decorator, dotenv, env, poc
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/config-decorator
- Size: 1.06 MB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# config-decorator
PoC: simple config decorator with type casting, validation and env-driven out of the box## TL;DR
```bash
npm i config-decorator
``````typescript
import { Config, Nullable, Option } from 'config-decorator';@Config('app')
export class AppConfig {
@Option({
type: 'number',
default: 3000,
})
@Nullable()
public readonly port!: number;
}const appConfig = new AppConfig();
console.log(appConfig.port);
// 3000
```Environment:
```dotenv
APP_PORT=3000
```