title: Can I move configuration from appsettings.json to database in an ASP.NET Core MVC application?
body: <p>I have this application that uses the <code>appsettings.json</code> to store some configurations like API addresses, tokens, paths to save files, etc.</p>
  
  <p>We don't have DevOps, so for each change we do in the appsettings, we need to ask infrastructure team to deploy the changes to production.</p>
  
  <p>That said, I'm thinking if it's possible to place some of this configuration in database and in the <code>Startup</code> constructor or in <code>ConfigureServices</code> to get this information from database and use it in the application.</p>
  
  <p>That's just to don't need a new deploy every time I add a new key to the appsettings for example. I would simply create a new record in the database and the app will use this configuration as if it is in the appsettings.</p>
  
  <p>Today we have this:</p>
  
  <pre><code>public Startup(IHostingEnvironment env)
  {
      var builder = new ConfigurationBuilder()
          .SetBasePath(env.ContentRootPath)
          .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
          .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
          .AddEnvironmentVariables();
  
      Configuration = builder.Build();
  }
  </code></pre>
  
  <p>And I want to know if there is viable, or possible something like this:</p>
  
  <pre><code>public Startup(IHostingEnvironment env)
  {
      var builder = new ConfigurationBuilder()
          .SetBasePath(env.ContentRootPath)
          .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
          .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
          .GetConfigFromDataBase() /// And this will be the method to get from DB the dynamic configuration
          .AddEnvironmentVariables();
  
      Configuration = builder.Build();
  }
  </code></pre>
  
  <p>Is it possible? Or I'm trying to reinvent the wheel?</p>
  
  <p>Thank you in advance for your time !</p>