Every time I cd
a particular directory using either Terminal or iTerm2 (I'm running Macos 10.14.5, Node 12.13.0), I get the following error that seems to be complaining about an ´.env´ file provided to me by my team. They are not getting the error.
.env:22: parse error near '}'
dotenv: error when sourcing '.env' file
.env:22: parse error near '}'
Line 22, which seems to be causing the error is
COOKIE_SETTINGS={"isSecure": false, "isSameSite": false, "isHttpOnly": true, "encoding": "base64json", "path": "/"}
Any clue how I might remedy this? Thanks for any insights.
You can't store objects inside .env
file.
The solution is to:
Stringify JSON object and save as env variable. Then parse and use it when you need your object.
Another solution is to write variables like this:
COOKIE_SETTINGS_IS_SECURE = false
COOKIE_SETTINGS_IS_SAME_SITE = false
...