title: I am missing something about .env, could you explain it to me?
body: <p>I have a very, basic, need: to store different endpoints for my APIs according to the environment. Suppose a simple file like this:</p>
  
  <pre><code>API_URL=http://localhost:8080
  </code></pre>
  
  <p>it should become, for my prod environment:</p>
  
  <pre><code>API_URL=http://myprodServer
  </code></pre>
  
  <p>and I'd like to have an integration test and a uat endpoint too!</p>
  
  <p>Looking at my package.json I see:</p>
  
  <pre><code>"scripts": {
  "start": "react-scripts start",
  "build": "react-scripts build",
  "test": "react-scripts test",
  </code></pre>
  
  <p>So my idea is:</p>
  
  <ol>
  <li>Put a command line argument near to "build" and "start" so to specify local and production enviroment files</li>
  <li>Have a way to access to said configuration in my app, say config.API_URL</li>
  </ol>
  
  <p>Now, I come from spring boot, and in spring boot I have a file per environment.</p>
  
  <p>I though dotenv could be my solution but I see two strange things on their website:</p>
  
  <ol>
  <li>Please don't commit your .env file --> so, how are my colleagues supposed to build my application? I usually at least push local and test environment, while keeping the uat and production files directly under the server</li>
  <li>You should have just one .env file --> ok this one destroys me: if I just have one file how am I supposed to handle several environments???</li>
  </ol>
  
  <p>What am I missing here? Could you help me solve my problem? I'm new to npm so I'm a little confused...</p>