<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="198871" data-post-id="198871">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="axelson" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/axelson/120/26351_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  axelson
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Scenic Core Team</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="zoedsoupe" data-post="5" data-topic="36506">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/zoedsoupe/48/25602_2.png" class="avatar"> zoedsoupe:</div>
<blockquote>
<p>The problem was that I was using <code>System.fetch_env!/1</code>, so all env vars weren’t loading on compile time… Changing to <code>System.get_env/2</code> solved the issue!</p>
</blockquote>
</aside>
<p>Just wanted to note that the change you made here didn’t actually make the difference you thought it did. Both of those calls are executed at the same time. Which is usually runtime unless you’re using a module attribute or some other compile time facility.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="198871" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/why-my-release-dont-get-env-vars/36506/12">Post #11</a>
	                </div>
	            </div>
              <div id="likers-container-198871" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="198871"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #11"></div>
  </section>
</div>
    <div class="postbit" id="198872" data-post-id="198872">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="zoedsoupe" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/zoedsoupe/120/25602_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  zoedsoupe
                      <span class="op-star" title="Thread Starter">
                        <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                      </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Yeah! Now I understand better the compile/runtime thing!</p>
<p>I can create the release as:<br>
<code>MIX_ENV=prod mix release</code></p>
<p>without any env var such as <code>DB_URL</code></p>
<p>But when I start the app I need to export or set on one-line!</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="198872" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/why-my-release-dont-get-env-vars/36506/13">Post #12</a>
	                </div>
	            </div>
              <div id="likers-container-198872" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="198872"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #12"></div>
  </section>
</div>
    <div class="postbit" id="198873" data-post-id="198873">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="zoedsoupe" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/zoedsoupe/120/25602_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  zoedsoupe
                      <span class="op-star" title="Thread Starter">
                        <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                      </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>However… You have any idea why my tests are breaking with this error:<br>
<code>** (ArgumentError) cookie store expects conn.secret_key_base to be set</code>?</p>
<p>It seems that on <code>test env</code> the app is retrieving th <code>SECRET_KEY_BASE</code> env var, but this one is only set on <code>runtime.exs</code></p>
<p>executing tests as:<br>
<code>SECRET_KEY_BASE=xxxxxxx mix test</code></p>
<p>gives me:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">Finished in 41.0 seconds
35 tests, 0 failures
</code></pre> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="198873" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/why-my-release-dont-get-env-vars/36506/14">Post #13</a>
	                </div>
	            </div>
              <div id="likers-container-198873" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="198873"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #13"></div>
  </section>
</div>
    <div class="postbit" id="198876" data-post-id="198876">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="NobbZ" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/NobbZ/120/27235_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  NobbZ
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>As far as I know, <code>config/test.exs</code> does not set or overwrite the <code>secret_key_base</code> in a default generated application.</p>
<p>So you might have changed some things for a reason or by accident. It does not make (much) sense to read the env during test. If you do not want to hardcode a <code>secret_key_base</code> in <code>config/config.exs</code> (which is still there) you can remove it there and use <code>config/runtime.exs</code> instead to read it from the env, while hardcoding some “well known secret” in <code>config/test.exs</code>.</p>
<p>Or you just don’t touch the value in the test config and use the one from the “main” config as a well known default, that you shouldn’t use in production then though.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="198876" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/why-my-release-dont-get-env-vars/36506/15">Post #14</a>
	                </div>
	            </div>
              <div id="likers-container-198876" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="198876"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-most-liked cat-most-liked" title="One of the top 3 liked posts in this thread!"></div>
  </section>
</div>
    <div class="postbit" id="198878" data-post-id="198878">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="zoedsoupe" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/zoedsoupe/120/25602_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  zoedsoupe
                      <span class="op-star" title="Thread Starter">
                        <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                      </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>That’s the problem… I didn’t change nothing for tests neither <code>test.exs</code></p>
<p>grepping for <code>SECRET_KEY_BASE</code> and <code>secret_key_base</code> gaves me this:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">conts git:(deploy)$✘!? elixir:(1.11.0)
ﬦ grep -rnw . -e 'secret_key_base' --exclude-dir deps -I -l
./erl_crash.dump
./config/runtime.exs
./config/config.exs
./assets/node_modules/phoenix/lib/phoenix/endpoint.ex
./assets/node_modules/phoenix/lib/phoenix/socket/transport.ex
./assets/node_modules/phoenix/lib/phoenix/token.ex
./assets/node_modules/phoenix/lib/phoenix/endpoint/supervisor.ex
./_build/prod/rel/conts/releases/0.1.0/runtime.exs
./_build/prod/rel/conts/releases/0.1.0/sys.config
./_build/prod/rel/conts/tmp/conts-0.1.0-20201230182825-2b8b.runtime.config

conts git:(deploy)$✘!? elixir:(1.11.0)
ﬦ grep -rnw . -e 'SECRET_KEY_BASE' --exclude-dir deps -I -l
./config/runtime.exs
./_build/prod/rel/conts/releases/0.1.0/runtime.exs
./deploy/deploy.sh
./deploy/Dockerfile
</code></pre>
<p>Which I think is totally fine</p>
<p>I’ll try rollback on one branch! I created a new one called <code>deploy</code> for this case! If everything goes wrong, rollback haha</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="198878" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/why-my-release-dont-get-env-vars/36506/16">Post #15</a>
	                </div>
	            </div>
              <div id="likers-container-198878" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="198878"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #15"></div>
  </section>
</div>
    <div class="postbit" id="198880" data-post-id="198880">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="zoedsoupe" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/zoedsoupe/120/25602_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  zoedsoupe
                      <span class="op-star" title="Thread Starter">
                        <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                      </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>If you get here from google, I strongly advise you to read the entire topic! You’ll learn a lot!</p>
<p>Yeah! Rolling back to another branch solved the test issues…</p>
<p>So summing up:</p>
<p>env var not matter on creating a release with<br>
<code>MIX_ENV=prod mix release</code></p>
<p>they only matter on starting the release!</p>
<p>Thank you all so much!</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="198880" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/why-my-release-dont-get-env-vars/36506/17">Post #16</a>
	                </div>
	            </div>
              <div id="likers-container-198880" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="198880"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-solved cat-solved" title="Marked as solution"></div>
  </section>
</div>
    <div class="postbit" id="198884" data-post-id="198884">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="NobbZ" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/NobbZ/120/27235_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  NobbZ
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="zoedsoupe" data-post="17" data-topic="36506">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/zoedsoupe/48/25602_2.png" class="avatar"> zoedsoupe:</div>
<blockquote>
<p>env var not matter on creating a release with<br>
<code>MIX_ENV=prod mix release</code></p>
</blockquote>
</aside>
<p>It is not that easy. Depending on how and where you read them they might also affect the build.</p>
<p><code>config/runtime.exs</code> is only evaluated during application boot, therefore its solely <em>runtime</em> config.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="198884" data-batch-url="/posts/batch_likers">
                        2
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/why-my-release-dont-get-env-vars/36506/18">Post #17</a>
	                </div>
	            </div>
              <div id="likers-container-198884" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="198884"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-most-liked cat-most-liked" title="One of the top 3 liked posts in this thread!"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <span class="all-loaded">— All posts loaded —</span>
</div></template></turbo-stream>