0.1.3 • Published 7 years ago
env-import v0.1.3
env-import
Configure environment variables with dotenv in one absolute import using ES6 import syntax.
I made this because ESLint was complaining about my enviroment variables configuration file relative import being before the absolute imports
// import dotenv in env.js file and run dotenv.config() there
import './env';
// other absolute imports
or any code being before imports
import dotenv from 'dotenv';
dotenv.config();
// other absolute imports
and some of dependecies rely on environment variables being configured to function properly (like api-error-handler in here)
Usage
// With .env in your root directory
import 'env-import'
// Now all environment variables are configured