Skip to content

Instantly share code, notes, and snippets.

@BadgerCode
Created February 6, 2019 18:01
Show Gist options
  • Save BadgerCode/8b349f04997d7fff49265cd3f6afe763 to your computer and use it in GitHub Desktop.
Save BadgerCode/8b349f04997d7fff49265cd3f6afe763 to your computer and use it in GitHub Desktop.
Loads local.settings.json into environment variables for acceptance testing functions
var config = JObject.Parse(File.ReadAllText(Path.Join(Directory.GetCurrentDirectory(), "local.settings.json")));
foreach (var configOption in config["Values"])
{
var option = (JProperty) configOption;
var key = option.Name;
var value = option.Value.ToString();
Environment.SetEnvironmentVariable(key, value);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment