Skip to content

Commit

Permalink
fix: added dotenv-extended now that it is fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
niftylettuce committed Dec 13, 2019
1 parent 9dd62e9 commit 45f383a
Show file tree
Hide file tree
Showing 4 changed files with 4,710 additions and 3,349 deletions.
26 changes: 16 additions & 10 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@
const dotenvExtended = require('@ladjs/dotenv-extended');
const dotenvExtended = require('dotenv-extended');
const Mustache = require('mustache');
const dotenvParseVariables = require('dotenv-parse-variables');

const setupEnv = (config = {}) => {
config = Object.assign(
{
errorOnMissing: true,
errorOnExtra: true
},
config
);
config = {
encoding: 'utf8',
silent: true,
path: '.env',
defaults: '.env.defaults',
schema: '.env.schema',
errorOnMissing: true,
errorOnExtra: true,
errorOnRegex: false,
includeProcessEnv: true,
assignToProcessEnv: true,
overrideProcessEnv: false,
...config
};

let env = dotenvExtended.load(config);
Object.keys(env).forEach(key => {
if (env[key].indexOf('{{') !== -1)
env[key] = Mustache.render(env[key], env);
if (env[key].includes('{{')) env[key] = Mustache.render(env[key], env);
});
env = dotenvParseVariables(env);
Object.keys(env).forEach(key => {
Expand Down
45 changes: 26 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,24 @@
"Nick Baugh <niftylettuce@gmail.com> (http://niftylettuce.com/)"
],
"dependencies": {
"@ladjs/dotenv-extended": "^3.0.0",
"dotenv-parse-variables": "^0.1.0",
"mustache": "^2.3.0"
"dotenv-extended": "^2.6.0",
"dotenv-parse-variables": "^0.2.3",
"mustache": "^3.1.0"
},
"devDependencies": {
"ava": "^0.24.0",
"codecov": "^3.0.0",
"cross-env": "^5.1.3",
"eslint": "^4.13.1",
"eslint-config-prettier": "^2.9.0",
"eslint-plugin-prettier": "^2.4.0",
"husky": "^0.14.3",
"lint-staged": "^6.0.0",
"nyc": "^11.4.1",
"prettier": "^1.9.2",
"remark-cli": "^4.0.0",
"remark-preset-github": "^0.0.7",
"xo": "^0.19.0"
"ava": "^2.4.0",
"codecov": "^3.6.1",
"cross-env": "^6.0.3",
"eslint": "^6.7.2",
"eslint-config-prettier": "^6.7.0",
"eslint-plugin-prettier": "^3.1.1",
"husky": "^3.1.0",
"lint-staged": "^9.5.0",
"nyc": "^14.1.1",
"prettier": "^1.19.1",
"remark-cli": "^7.0.1",
"remark-preset-github": "^0.0.16",
"xo": "^0.25.3"
},
"engines": {
"node": ">=8.3"
Expand Down Expand Up @@ -61,11 +61,16 @@
"prettier --write --single-quote --trailing-comma none",
"git add"
],
"*.md": ["remark . -qfo", "git add"]
"*.md": [
"remark . -qfo",
"git add"
]
},
"main": "index.js",
"remarkConfig": {
"plugins": ["preset-github"]
"plugins": [
"preset-github"
]
},
"repository": {
"type": "git",
Expand All @@ -80,7 +85,9 @@
},
"xo": {
"extends": "prettier",
"plugins": ["prettier"],
"plugins": [
"prettier"
],
"parserOptions": {
"sourceType": "script"
},
Expand Down
2 changes: 1 addition & 1 deletion test/test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const test = require('ava');

const setupEnv = require('../');
const setupEnv = require('..');

test('is function', t => {
t.true(typeof setupEnv === 'function');
Expand Down
Loading

0 comments on commit 45f383a

Please sign in to comment.