Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update System.Configuration.ConfigurationManager.Appsettings property to read appsettings.json #33

Closed
lindydonna opened this issue Jan 19, 2017 · 9 comments
Labels
Milestone

Comments

@lindydonna
Copy link
Contributor

From @jimt4593 on January 18, 2017 6:44

Right now, the only way to read appsettings, stored is apsettings.json, is from the environment. My Azure Function uses assemblies that user ConfigurationManager.AppSettings to read app setting values. These assemblies are also used by Azure web apps and web apps that still run on web servers running on premise.

I do not want to have to update these assemblies to access app settings in 2 ways. Using ConfigurationManager. AppSettings first. Then, if not found, using Envirorment.GetEnviromentVariable. I'd like to requst that ConfigurationManager.Appsettings be updated to read values from the application.json file.

Copied from original issue: Azure/Azure-Functions#149

@markmonster
Copy link

Is there any indication when this is available for use?

@lindydonna
Copy link
Contributor Author

@mkamonster It will be in the 0.10 release, which will be out within a few days. We'll create a new "release" on the releases page.

@markmonster
Copy link

Thanks for the feedback Donna! In that case we will use a small workaround for the remaining days.

@markmonster
Copy link

Wow, that's nice. It's already released. It works like a charm. For the people wondering on where to put settings in appsettings.json. Make use of the Values property for your keys.

{
  "IsEncrypted": false,
  "Values": {
    "AzureWebJobsStorage": "",
    "AzureWebJobsDashboard": "",
    "Message": "Hello world!"
  }
}

You can in this case access the message via:

ConfigurationManager.AppSettings["Message"]

@lindydonna
Copy link
Contributor Author

@mkamonster Thanks for providing the example! As you can see, our documentation is lagging behind our releases at the moment. :) I'll make sure to add this example to the documentation work item.

@jimt4593
Copy link

How do I get the update? Do I just download WebToolsAzure2015.exe (from https://aka.ms/azfunctiontools) again?

@markmonster
Copy link

At the moment of running I got the message if I wanted to upgrade the cli. I did. But because it's a npm package I think updating it via npm should work as well.

@ahmelsayed
Copy link
Contributor

ahmelsayed commented Feb 12, 2017

actually VS doesn't use the npm package. VS has it's own logic to check for updates and download the latest tooling. It happens once per VS session though (as far as I know), so you'd have to kill all VS instances and then launch it. When you try to run any functions projects you'll get notified to upgrade.
If you're using the cli through npm, then you just need to update it there npm i -g azure-functions-cli

@jimt4593
Copy link

jimt4593 commented Feb 14, 2017

When you try to run any functions projects you'll get notified to upgrade.

Thanks. I was prompted as you described.

@ghost ghost locked as resolved and limited conversation to collaborators Dec 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants