Reputation: 107
In my nodejs project during development I'm using .env
file for using environment variables
and one of the variables is set to be like this
varName = {"key1": "value2", "key2":"value2"}
can i set the same variable with same format in azure environment variable ?? does azure accept it ?
please note: that i have no access to azure and i am only allowed to work locally on my machine where my code is working fine
Upvotes: 0
Views: 357
Reputation: 24138
Sure, you can set the same variable with same format in azure environment variable, as the figure below. I added a new application setting in the tab Configuration
of Azure WebApp on Azure portal.
Then, I moved to the Kudu console of the Azure WebApp to inspect whether the TEST
variable with a json string exists via the code node -e "console.log(process.env)"
as the figure below.
And I found it as the figure below.
As @AZ_ said, the TEST
variable value is a string, you need to use JSON.parse
to convert it to JSON object.
var test = JSON.parse(process.env.TEST);
console.log(test.key1);
Upvotes: 1