title: Why when I start uvicorn in my FastAPI service does my configuration method run twice?
body: <p>I have written a service using fastapi and uvicorn. I have a main in my service that starts uvicorn (see below).  In that main, the first thing I do is load configuration settings.  I have some INFO outputs that output the settings when I load the configuration.  I notice when I start my service, the configuration loading method seems to be running twice.</p>
  <pre><code># INITIALIZE
  if __name__ == &quot;__main__&quot;:
      # Load the config once at bootstrap time. This outputs the string &quot;Loading configuration settings...&quot;
      config = CdfAuthConfig()
      print(&quot;Loaded Configuration&quot;)
      # Create FastAPI object
      app = FastAPI()
      # Start uvicorn
      uvicorn.run(app, host=&quot;127.0.0.1&quot;, port=5050)
  </code></pre>
  <p>The output when I run the service looks like:</p>
  <pre><code>Loading configuration settings...
  Loading configuration settings...
  Loaded Configuration
  </code></pre>
  <p>Why is the &quot;CdfAuthConfig()&quot; class being instantiated twice?  It obviously has something to do with the &quot;uvicorn.run&quot; command.</p>