This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

@forrestjs/service-env

5.0.3 • Public • Published

@forrestjs/service-env (deprecated)

🚧 DEPRECATED 🚧
The environment should be managed explicitly from the App manifest.

ForrestJS service which helps importing environment variables from .env.* files:

  • .env
  • .env.local
  • .env.{NODE_ENV}
  • .env.{NODE_ENV}.local

We suggest you write your safe default values in a .env file which gets committed into your version control, then gitignore the *.local files and use them to store variables that are bound to the execution context (your laptop, a production server).

When things work in the best possible way, .env.development should contain all the info that allow a new developer to boot the app in development mode on her machine.

Usage

This service injects a getEnv() method into the Hooks App execution context:

const forrestjs = require('@forrestjs/core');

forrestjs.run({
  services: [require('@forrestjs/service-env')],
  features: [
    {
      target: '$FINISH',
      handler: (args, ctx) => console.log(getEnv('FOO'), 'default for "foo"'),
    },
  ],
});

After the Hooks App gets initialized, you can also directly import getEnv():

const { getEnv } = require('@forrestjs/service-env');

Package Sidebar

Install

npm i @forrestjs/service-env

Weekly Downloads

31

Version

5.0.3

License

MIT

Unpacked Size

5.42 kB

Total Files

6

Last publish

Collaborators

  • marcopeg