Skip to content

Instantly share code, notes, and snippets.

@configureappio
Created April 2, 2018 15:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save configureappio/5ca8343417d37c1cd5ef7987a1b521c2 to your computer and use it in GitHub Desktop.
Save configureappio/5ca8343417d37c1cd5ef7987a1b521c2 to your computer and use it in GitHub Desktop.
Example of using a PhysicalFileProvider to access a JSON file outside of the web site
public class Program
{
public static void Main(string[] args)
{
BuildWebHost(args).Run();
}
public static IWebHost BuildWebHost(string[] args)
{
var webhost = WebHost.CreateDefaultBuilder(args);
// In the real world you could use this to map to a file outside of source control
webhost.ConfigureAppConfiguration(c => { c.AddJsonFile(new PhysicalFileProvider(@"C:\"), @"mysecrets.json", true, true); });
return webhost.UseStartup<Startup>().Build();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment