0.4.1 • Published 8 months ago

pm2-dotenv v0.4.1

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

pm2-dotenv

A package to load environment variables from .env files for PM2 ecosystem.config.js.

Features

  • Automatically loads environment variables from .env.<environment> files in the project directory.

Installation

yarn add pm2-dotenv

Usage

Prepare your .env files in the project directory, note that all the env variables must be prefixed with the app name.

APP1_NAME=app # this will be load to the app1 and the name will be NAME
APP2_NAME=worker # this will be load to the app2 and the name will be NAME

Use the injectEnvs() function to inject environment variables

const { injectEnvs } = require('pm2-dotenv')

module.exports = {
  apps: [
    {
      name: 'app',
      script: 'app.js',
      ...injectEnvs('app'),
    },
    {
      name: 'worker',
      script: 'worker.js',
      ...injectEnvs('worker'),
    }
  ],
};
0.4.1

8 months ago

0.4.0

10 months ago

0.3.1

10 months ago

0.3.0

1 year ago

0.2.2

1 year ago

0.2.1

1 year ago

0.2.0

1 year ago

0.1.0

1 year ago