Saturday 15 March 2014

node.js - JSON stored in AWS EB envrionment variables is retrieved without quotes -



node.js - JSON stored in AWS EB envrionment variables is retrieved without quotes -

i'm running node.js eb container , trying store json within environment variable. json stored correctly, when retrieving via process.env.myvariable returned double quotes stripped.

e.g. myvariable looks this:

{ "prop": "value" }

when retrieve via process.env.myvariable value actualy { prop: value} isn't valid json. i've tried escape quotes '\' ie { \"prop\": \"value\" } adds more weird behavior string comes {\ \"prop\\":\ \"value\\" }. i've tried wrapping whole thing in single quotes e.g. '{ "prop": "value" }', seems strip out too.

anyone know how store json in environment variables?

edit: more info, appear characters beingness doubly escaped when set environment variable. e.g. if wrap object in single quotes. value when fetch using sdk, becomes:

\'{ "prop": "value"}\'

also if leave quotes out, backslashes escaped if object looks {"url": "http://..."} result when query via sdk {"url": "http:\\/\\/..."}

not mangling text, it's rearranging json properties, properties appearing in different order set them to.

update

so seems bug in aws based on fact seems mangling values submitted. happens whether utilize node.js sdk or web console. workaround i've taken replacing double quotes single quotes on json object during deployment , 1 time again in application.

node.js amazon-web-services elastic-beanstalk

No comments:

Post a Comment