Access appsettings.json values in controller classes
<p>Having trouble figuring out how to read appsettings.json values outside of the startup.cs. What I would like to do is, for instance, is in the _Layout.cshtml, add the site name from the config:</p>

<p>For example:</p>

<pre><code>ViewData["SiteName"] = Configuration.GetValue&lt;string&gt;("SiteSettings:SiteName");
</code></pre>

<p>Or even better:</p>

<pre><code>public class GlobalVars {
    public static string SiteName =&gt; Configuration.GetValue&lt;string&gt;("SiteSettings:SiteName");
}
</code></pre>

<p>Here's my code thus far:</p>

<p>[appsettings.json]</p>

<pre><code>"SiteSettings": {
    "SiteName": "MySiteName"
}
</code></pre>

<p>[startup.cs]</p>

<pre><code>public Startup(IHostingEnvironment env)
{
    var builder = new ConfigurationBuilder()
        .SetBasePath(env.ContentRootPath)
        .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
        .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
        .AddEnvironmentVariables();
    Configuration = builder.Build();

    var siteName = Configuration.GetValue&lt;string&gt;("SiteSettings:SiteName");
}

public IConfigurationRoot Configuration { get; }
</code></pre>

<p>Maybe I'm reading the docs wrong, but I can't seem to expose the Configuration object outside of the Startup class.</p>