title: Configure URL depending on environment
body: <p>I have published a website (MVC frontend) and an API, that is hosted on Azure on two different domains. The MVC frontend calls the API (through url), but right now, I manually switch the url manually between when I work locally, and when I deploy it:</p>
  <pre><code>HttpClient client = new HttpClient();
  client.BaseAddress = new Uri(&quot;https://myApiDomain.azurewebsites.net&quot;); //https://localhost:44393/ 
                                                                     /* I set one URL as 
                                                                      baseaddress and keep 
                                                                      the other in a comment,
                                                                      depending on environment */
  </code></pre>
  <p>Right now it is set to the hosted API address, myApiDomain. So if I work locally, I exchange the two addresses. And when I deploy, I put back in the azurewebsites-url.</p>
  <p>Also, I would prefer not committing the URL directly to the source-code, but maybe a config file or similar instead - preferably one that is commonly ignored by git, so that it will not be displayed if its open source-code.</p>
  <p>What is the smarter way to do this?</p>