title: Reload configuration when env variable has changed
body: <p>In Startup.cs file I have</p>
  
  <pre><code>public Startup(IHostingEnvironment env)
  {
      var builder = new ConfigurationBuilder()
          .SetBasePath(env.ContentRootPath)
          .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)            
          .AddEnvironmentVariables();
      Configuration = builder.Build();
  }
  </code></pre>
  
  <p>There is <em>appsettings.json</em> file with configurations. Like :</p>
  
  <pre><code>{
    "Log" : {
       "Type" : "value from appsettings.json"
     }
  }
  </code></pre>
  
  <p><code>reloadOnChange</code> set to <code>true</code>, so, when I change <em>appsettings.json</em> then I get immediately a new value of log type in my program.</p>
  
  <p>But I'm using Docker with docker-compose and pass a value of setting by env variables. My <em>docker-compose.override.yml</em> file is: </p>
  
  <pre><code>version: '3.7'
  
  services:
  
    myservice:
      environment:
        ASPNETCORE_ENVIRONMENT: Development
        Log__Type: "value from docker-compose"
  </code></pre>
  
  <p>To run I use `docker-compose up. Now my app has value "value from docker-compose" for log type. </p>
  
  <p><strong>Question:</strong> Are there any ways to change a value of env variable (<code>Log__Type</code>) at runtime (without restarting docker container) and reload configuration in my app as it has done with <code>reloadOnChange</code> and appsettings.json?</p>
  
  <p>I tried to connect to the container (<code>docker exec</code>) and set a new value of env variable </p>
  
  <pre><code>printenv Log__Type  // -&gt; value from docker-compose
  export Log__Type=new value 
  printenv Log__Type  // -&gt; new value 
  </code></pre>
  
  <p>but my app didn't reload configuration and still shows log type "value from docker-compose". </p>
  
  <p>Could you please advise how to change settings at runtime using docker? Or explain why there is only reload when the file has changed but not env variable.</p>