title: Best practices for managing multiple environment variables in prodution
body: <p>Although I am not familiar with DevOps best practices, I am trying to come up with a reliable and efficient method for managing multiple variables in production. The following represents my current approach:</p>
  
  <pre><code>/
  |ENV_VAR.sh
  |--/api1
  |--/staging.api1
  |--/api2
  |--/staging.api2
  </code></pre>
  
  <p>Where:</p>
  
  <p>ENV_VAR.sh</p>
  
  <pre><code>### API 1 variables ###
  export API1_VAR_1=foo
  export API1_VAR_2=foo2
  export API1_STAG_VAR_1=foo_stag
  export API1_VAR_2=foo2_stag2
  
  ### API 2 variables ###
  export API2_VAR_1=foo
  export API2_VAR_2=foo2
  export API2_STAG_VAR_1=foo_stag
  export API2_VAR_2=foo2_stag2
  </code></pre>
  
  <p>The API 1 and 2 are two nodejs-based apps running in the same server using a reverse-proxy configuration.
  If nothing goes bad with the server (e.g. unexpected shutdown), I just have to (re)set the variables once in a while via <code>SOURCE ENV_VAR.SH</code> in order to make sure that new variables are defined.</p>
  
  <p>Before proceeding with this approach, I would like to know whether it is correct at all, or if it has a big flaw.
  If this approach is alright, how to automatically (re)source the environment variables from the <code>package.json</code> whenever a new version of any App is deployed? (just to guarantee that the variables are still defined)</p>
  
  <p>Thanks in advance.</p>