tmpl-cli
api
docs
env
env
git
hbs
html
husky
jest
lintstaged
lisp
node
prettier
python
react
readme
schema
style
util
vue
web

$ tmpl env

Sub CLI for env generator. Creates env files under /env with a config.

Files

project
└─env
└──.env.development
└──.env.local
└──.env.production
└──.env.staging
└──config.js

.env.development

LEVEL=development

.env.local

LEVEL=local

.env.production

LEVEL=production

.env.staging

LEVEL=staging

config.js

const path = require("path");
const dotenv = require("dotenv");
const level = (process.env.LEVEL || process.env.PROMOTION_LEVEL || "LOCAL").toLocaleUpperCase();
const region = (process.env.REGION || "us-east-1").toLocaleLowerCase();
let envFile = ".env.local";
switch (level) {
case "DEVELOPMENT":
envFile = ".env.development";
break;
case "STAGING":
envFile = ".env.staging";
break;
case "PRODUCTION":
envFile = ".env.production";
break;
}
const envPath = path.join(__dirname, envFile);
const config = () => dotenv.config({ path: envPath });
module.exports = {
config,
envPath,
level,
region
};