Windows: load settings.json in environment variable


#1

Hi,

I try something simple but nothing works. I try to deploy meteor 1.4 to node 4.4.7

I get: not valid Json error or I get “my var” undefined

So what should my bat file look like?
Set METEOR_SETTINGS: path to .json?

Do I need a complete script? http://stackoverflow.com/questions/19356220/how-to-parse-a-json-file-to-variables-with-the-windows-command-line

Found it: use powershell not cmd…

If you are using Meteor settings, the entire json block needs to be stringified and pasted into the METEOR_SETTINGS environment variable.

The following Powershell 3.0 snippet will do this for you (assuming you run these commands from a directory with a file named settings.json):

$settings = Get-Content settings.json -Raw
$settings = $settings -replace “n","" -replace "r”,"" -replace " “,”"
[Environment]::SetEnvironmentVariable(“METEOR_SETTINGS”, $settings, “Machine”)

Thank you!


Windows: docker or node run and refer to settings.json file
#2

No, I still get “not valid Json error”

I expect I am missing a " ’ somewhere

Ps: the settings file works fine in the meteor client build tool