Skip to content

presenter-env 1.0.0

Install from the command line:
Learn more about npm packages
$ npm install @heronlabs/presenter-env@1.0.0
Install via package.json:
"@heronlabs/presenter-env": "1.0.0"

About this version

Env

License: MIT Build Status

This is module for access process environment

TypeScript GTS Jest NestJS

How it works

Given key from environment retrieve the value.

Installation

npm install @heronlabs/presenter-env
yarn add @heronlabs/presenter-env

Usage

require('dotenv').config();

import {
  BufferEnvPresenter,
  EnvBootstrap,
  Environment,
  NumberEnvPresenter,
  TextEnvPresenter,
} from '@heronlabs/presenter-env';

import {Module, Inject} from '@nestjs/common';

export class Configuration {
  public server = {
    port: this.numberEnvPresenter.getValueByKey('API_PORT'),
  };

  public jwt = {
    publicKey: this.bufferEnvPresenter.getValueByKey('JWT_PUBLIC_KEY_PATH'),
    algorithm: this.textEnvPresenter.getValueByKey('JWT_ALGORITHM'),
  };

  constructor(
    @Inject(NumberEnvPresenter) private numberEnvPresenter: Environment<number>,
    @Inject(BufferEnvPresenter) private bufferEnvPresenter: Environment<Buffer>,
    @Inject(TextEnvPresenter) private textEnvPresenter: Environment<string>
  ) {}
}

@Module({
  providers: [Configuration],
  imports: [EnvBootstrap],
})
export class ApiBootstrap {}

Built with

Details


Assets

  • presenter-env-1.0.0.tgz

Download activity

  • Total downloads 1
  • Last 30 days 0
  • Last week 0
  • Today 0

Recent versions

View all