Altra conversione in Typescript , partendo da un progetto di esempio funzionante...
This commit is contained in:
12
config/envparser.js
Normal file
12
config/envparser.js
Normal file
@@ -0,0 +1,12 @@
|
||||
const DotEnv = require('dotenv').config({ debug: process.env.DEBUG })
|
||||
const parsedEnv = DotEnv.config().parsed;
|
||||
|
||||
module.exports = function () {
|
||||
// Let's stringify our variables
|
||||
for (key in parsedEnv) {
|
||||
if (typeof parsedEnv[key] === 'string') {
|
||||
parsedEnv[key] = JSON.stringify(parsedEnv[key])
|
||||
}
|
||||
}
|
||||
return parsedEnv
|
||||
};
|
||||
3
config/helpers/env.js
Normal file
3
config/helpers/env.js
Normal file
@@ -0,0 +1,3 @@
|
||||
module.exports = function (key, fallback) {
|
||||
return process.env[key] || fallback
|
||||
}
|
||||
Reference in New Issue
Block a user