This version reverts the functionality where figaro-js
casts values to primitives. In this version, figaro-js
will read all values as strings. In order to emulate the former functionality, you can use a function to do it manually:
const Figaro = require('figaro-js')
const { mapValues } = require('lodash')
// Converts strings to primitive values if possible
// Eg '5' -> 5, 'true' -> true, 'string' -> 'string'
function coerce(str) {
try {
return JSON.parse(str)
} catch (e) {
return str
}
}
const myEnv = mapValues(Figaro.read(), coerce)