npm package: @juniorcitizen/environment-variables
Description: provides access to environment variables and flexible default settings for node.js projects
Author: juniorCitizen
Latest version: 0.0.1-alpha.10

# @juniorcitizen/environment-variables

> provides modularized and type-safe access to environment variables with sensible defaults for node.js projects

## Outline

- [Installation](#installation)
- [Usage](#usage)
- [API](#api)
  - [AdminEnvVars](#adminenvvars)
  - [JwtEnvVars](#jwtenvvars)
  - [MongoEnvVars](#mongoenvvars)
  - [RedisEnvVars](#redisenvvars)
  - [ServerEnvVars](#serverenvvars)
  - [SessionEnvVars](#sessionenvvars)
  - [ValidationEnvVars](#validationenvvars)

## Installation

```console
npm install @juniorcitizen/environment-variables
```

## Usage

```js
import {ServerEnvVars} from '@juniorcitizen/environment-variables'

const serverEnvVars = new ServerEnvVars()

// to access the 'PORT' variable
console.log(serverEnvVars.PORT) // => 3001

// destructure to access individual values
const {PORT} = serverEnvVars
console.log(PORT) // => 3001
```

## API

> ### _**AdminEnvVars**_

- _AdminEnvVars.**ADMIN_EMAIL**_: **string | undefined**

  - default: _**undefined**_
  - key: _**process.env.ADMIN_EMAIL**_

- _AdminEnvVars.**ADMIN_USER_NAME**_: **string | undefined**

  - default: _**undefined**_
  - key: _**process.env.ADMIN_USER_NAME**_

> ### _**JwtEnvVars**_

- _JwtEnvVars.**ACCESS_DURATION**_: **number**

  - default: _**60000**_ (one minute in milliseconds)
  - key: _**process.env.ACCESS_DURATION**_

- _JwtEnvVars.**ACCESS_SECRET**_: **string**

  - default: _**(random string of 24 characters)**_
  - key: _**process.env.ACCESS_SECRET**_

- _JwtEnvVars.**REFRESH_DURATION**_: **number**

  - default: _**604800000**_ (one week in milliseconds)
  - key: _**process.env.REFRESH_DURATION**_

- _JwtEnvVars.**REFRESH_SECRET**_: **string**

  - default: _**(random string of 24 characters)**_
  - key: _**process.env.REFRESH_SECRET**_

- _JwtEnvVars.**RESET_DURATION**_: **number**

  - default: _**3600000**_ (one hour in milliseconds)
  - key: _**process.env.RESET_DURATION**_

- _JwtEnvVars.**RESET_SECRET**_: **string**

  - default: _**(random string of 24 characters)**_
  - key: _**process.env.RESET_SECRET**_

- _JwtEnvVars.**VERIFY_DURATION**_: **number**

  - default: _**259200000**_ (three days in milliseconds)
  - key: _**process.env.VERIFY_DURATION**_

- _JwtEnvVars.**VERIFY_SECRET**_: **string**

  - default: _**(random string of 24 characters)**_
  - key: _**process.env.VERIFY_SECRET**_

> ### _**MongoEnvVars**_

- _MongoEnvVars.**MONGO_DATABASE**_: **string**

  - default: _**'default_database'**_
  - key: _**process.env.MONGO_DATABASE**_

- _MongoEnvVars.**MONGO_HOST**_: **string**

  - default: _**'0.0.0.0'**_
  - key: _**process.env.MONGO_HOST**_

- _MongoEnvVars.**MONGO_PASSWORD**_: **string**

  - default: _**undefined**_
  - key: _**process.env.MONGO_PASSWORD**_

- _MongoEnvVars.**MONGO_PORT**_: **number**

  - default: _**6379**_
  - key: _**process.env.MONGO_PORT**_

- _MongoEnvVars.**MONGO_USER_NAME**_: **string**

  - default: _**undefined**_
  - key: _**process.env.MONGO_USER_NAME**_

> ### _**RedisEnvVars**_

- _RedisEnvVars.**REDIS_HOST**_: **string**

  - default: _**'0.0.0.0'**_
  - key: _**process.env.REDIS_HOST**_

- _RedisEnvVars.**REDIS_PASSWORD**_: **string**

  - default: _**undefined**_
  - key: _**process.env.REDIS_PASSWORD**_

- _RedisEnvVars.**REDIS_PORT**_: **number**

  - default: _**6379**_
  - key: _**process.env.REDIS_PORT**_

- _RedisEnvVars.**REDIS_TTL**_: **number**

  - default: _**60000**_ (one minute in milliseconds)
  - key: _**process.env.REDIS_TTL**_

> ### _**ServerEnvVars**_

- _ServerEnvVars.**FAVICON_FILE_NAME**_: **string**

  - default: _**'favicon.ico'**_
  - key: _**process.env.FAVICON_FILE_NAME**_

- _ServerEnvVars.**PORT**_: **number**

  - default: _**3001**_
  - key: _**process.env.PORT**_

- _ServerEnvVars.**PROD_MODE**_: **boolean**

  - default: _**false**_
  - key: _**process.env.NODE_ENV**_

- _ServerEnvVars.**PUBLIC_PATH**_: **string**

  - default: _**'./public'**_
  - key: _**process.env.PUBLIC_PATH**_

- _ServerEnvVars.**VIEWS_PATH**_: **string**

  - default: _**'./views'**_
  - key: _**process.env.VIEWS_PATH**_

> ### _**SessionEnvVars**_

- _SessionEnvVars.**SESSION_ABSOLUTE_TIMEOUT**_: **number**

  - default: _**604800000**_ (one week in milliseconds)
  - key: _**process.env.SESSION_ABSOLUTE_TIMEOUT**_

- _SessionEnvVars.**SESSION_IDLE_TIMEOUT**_: **number**

  - default: _**600000**_ (ten minutes in milliseconds)
  - key: _**process.env.SESSION_IDLE_TIMEOUT**_

- _SessionEnvVars.**SESSION_NAME**_: **string**

  - default: _**'default_session'**_
  - key: _**process.env.SESSION_NAME**_

> ### _**ValidationEnvVars**_

- _ValidationEnvVars.**EMAIL_MAX_LENGTH**_: **number**

  - default: _**128**_
  - key: _**process.env.EMAIL_MAX_LENGTH**_

- _ValidationEnvVars.**EMAIL_MIN_LENGTH**_: **number**

  - default: _**8**_
  - key: _**process.env.EMAIL_MIN_LENGTH**_

- _ValidationEnvVars.**PASSWORD_MAX_LENGTH**_: **number**

  - default: _**64**_
  - key: _**process.env.PASSWORD_MAX_LENGTH**_

- _ValidationEnvVars.**PASSWORD_MIN_LENGTH**_: **number**

  - default: _**12**_
  - key: _**process.env.PASSWORD_MIN_LENGTH**_

- _ValidationEnvVars.**USER_NAME_MAX_LENGTH**_: **number**

  - default: _**64**_
  - key: _**process.env.USER_NAME_MAX_LENGTH**_

- _ValidationEnvVars.**USER_NAME_MIN_LENGTH**_: **number**

  - default: _**8**_
  - key: _**process.env.USER_NAME_MIN_LENGTH**_