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


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="bitwalker" data-post="43" data-topic="14302">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/bitwalker/48/998_2.png" class="avatar"> bitwalker:</div>
<blockquote>
<p>If we are going to view <code>config.exs</code> as compile-time config though, I think that is confusing, and is going to continue to be confusing, even with additions like <code>on_boot</code> . I’ve always viewed <code>config.exs</code> in the same way that I view <code>.conf</code> , <code>.ini</code> and other config files in that vein - and I suspect I’m far from alone in that.</p>
</blockquote>
</aside>
<p>As an aside, this surprised me too.  I quickly realized ‘how’ it works, but it still seems super weird to me to this day and I still mentally try to parse it as a run-time configuration instead of a build-time configuration…</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="82523" 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/proposal-moving-towards-discoverable-config-files/14302/44">Post #43</a>
	                </div>
	            </div>
              <div id="likers-container-82523" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="82523"
                     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 #43"></div>
  </section>
</div>
    <div class="postbit" id="82526" data-post-id="82526">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="josevalim" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/josevalim/120/1787_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  josevalim
                      <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 class="user-title">
									<span>Creator of Elixir</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="bitwalker" data-post="43" data-topic="14302">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/bitwalker/48/998_2.png" class="avatar"> bitwalker:</div>
<blockquote>
<p>Why not use <code>mix.exs</code> for compile-time configuration?</p>
</blockquote>
</aside>
<p>I really don’t think that the choice of my Ecto adapter or my logger compile_purge_level belong in <code>mix.exs</code>. The <code>mix.exs</code> is about how Mix compiles my project and Mix as a build tool in general, it is not about how my application interfaces with something as important as a logger.</p>
<p>I also don’t believe that users should have to know or care if a configuration is compile time or runtime unless they really have to. Imagine how much confusion we will have if now my Logger configuration is spread out in two places. The only time not knowing if a configuration happens at runtime or compile-time will be an issue is if the user expects something to happen at runtime but that is a compile time only option. That’s exactly where <code>on_boot</code> can be helpful: if we allow the user to declare their expectations via something like <code>on_boot</code>, we can detect those cases programatically.</p>
<aside class="quote no-group" data-username="bitwalker" data-post="43" data-topic="14302">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/bitwalker/48/998_2.png" class="avatar"> bitwalker:</div>
<blockquote>
<p>Not to mention that you can already do “compile-time” configuration for your own application in <code>mix.exs</code> :</p>
</blockquote>
</aside>
<p>No, you can’t configure <code>logger</code> in your own <code>def application do</code>.</p>
<aside class="quote no-group" data-username="bitwalker" data-post="43" data-topic="14302">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/bitwalker/48/998_2.png" class="avatar"> bitwalker:</div>
<blockquote>
<p>I guess my beef is with the fact that we are looking to make the distinction between compile-time and runtime configuration in <code>config.exs</code> with <code>on_boot</code></p>
</blockquote>
</aside>
<p>This issue is not about <code>on_boot</code> at all. Supporting releases is what will make the distinction between compile-time and runtime exist. The current proposal, as originally written, has the exact same compile vs. runtime issue as <code>on_boot</code>, except it is implicit and left up for the users to guess. <code>on_boot</code> is about making those differences explicit.</p>
<aside class="quote no-group" data-username="bitwalker" data-post="43" data-topic="14302">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/bitwalker/48/998_2.png" class="avatar"> bitwalker:</div>
<blockquote>
<p>I think we should re-evaluate why we think <code>config.exs</code> is the right place for compile-time config in the first place.</p>
</blockquote>
</aside>
<p>I will be straight-forward here: this is out of discussion. <code>config.exs</code> is executed at compilation time. It has been behaving like this for at least 4 years. It doesn’t matter how people <em>think</em> it behaves. Compile-time is how it behaves <strong>right now</strong> and we are not trying to change it. And libraries like Nerves, Phoenix, Ecto and Logger rely on this behaviour at different places. Suggesting to find a new home for all of those common configuration patterns would require a long-term migration effort (as both libraries and config files need to be rewritten). It is impractical at best (and IMO just plain undesirable). While I would agree some of this compile-time configuration should actually be moved to <em>lib</em> (such as the Ecto adapter), those few cases are rather the exception.</p>
<p>In fact, all of the alternatives brought up so far, such as command line application configuration, is not related to compile-time configuration, but rather to runtime configuration. In a release, the only thing I can specify at the command line, by definition, is runtime configuration. So if we really don’t want to mix compile time vs runtime, then the only option is to keep the <code>config.exs</code> as is and outside of releases, and use tools like command line options, Phoenix’ <code>init/2</code> callback and friends for the runtime configuration.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="82526" data-batch-url="/posts/batch_likers">
                        3
                      </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/proposal-moving-towards-discoverable-config-files/14302/45">Post #44</a>
	                </div>
	            </div>
              <div id="likers-container-82526" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="82526"
                     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 #44"></div>
  </section>
</div>
    <div class="postbit" id="82527" data-post-id="82527">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<blockquote>
<p>In fact, all of the alternatives brought up so far, such as command line application configuration, is not related to compile-time configuration, but rather to runtime configuration. In a release, the only thing I can specify at the command line, by definition, is runtime configuration. So if we really don’t want to mix compile time vs runtime, then the only option is to keep the config.exs as is and outside of releases, and use tools like command line options, Phoenix’ init/2 callback and friends for the runtime configuration.</p>
</blockquote>
<p>i like this proposal best of all. retain <code>config.exs</code> for compile time only and let it continue to work as it does. move runtime config to some other place</p>
<p>i think the confusion users experience in the difference between compile time and runtime is entirely a result of encouraging the use of the same file/process for both. separating them is probably the best thing that can be done to resolve this</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="82527" data-batch-url="/posts/batch_likers">
                        3
                      </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/proposal-moving-towards-discoverable-config-files/14302/46">Post #45</a>
	                </div>
	            </div>
              <div id="likers-container-82527" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="82527"
                     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 #45"></div>
  </section>
</div>
    <div class="postbit" id="82529" data-post-id="82529">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="josevalim" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/josevalim/120/1787_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  josevalim
                      <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 class="user-title">
									<span>Creator of Elixir</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="blatyo" data-post="36" data-topic="14302">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/blatyo/48/4554_2.png" class="avatar"> blatyo:</div>
<blockquote>
<p>I assumed the <code>import_config</code> change was a required step for supporting releases. If just <code>on_boot</code> were done, wouldn’t a release still not know where to pull in config?</p>
</blockquote>
</aside>
<p>The <code>import_config</code> change is necessary if we want to execute the same files in a release as we do for Mix. So we need to track the files. If we have <code>on_boot</code>, we only need to track the code inside <code>on_boot</code>.</p>
<aside class="quote group-Rebar3" data-username="talentdeficit" data-post="46" data-topic="14302">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/talentdeficit/48/1302_2.png" class="avatar"> talentdeficit:</div>
<blockquote>
<p>i think the confusion users experience in the difference between compile time and runtime is entirely a result of encouraging the use of the same file/process for both. separating them is probably the best thing that can be done to resolve this</p>
</blockquote>
</aside>
<p>The reason the confusion exists is because the compile/runtime is completely irrelevant for Mix but it exists in a release. Doing nothing means the major mismatch we see between Mix and releases in regards to <code>config</code> won’t be addressed.</p>
<p>Unless we strictly impose Mix to be a compile-time config only. This means that <code>MIX_ENV=prod PORT=4040 mix run</code> won’t have any effect if the project was already compiled with <code>PORT=8080</code>. But going down this path feels like we are breaking both approaches, instead of fixing them.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="82529" 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/proposal-moving-towards-discoverable-config-files/14302/47">Post #46</a>
	                </div>
	            </div>
              <div id="likers-container-82529" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="82529"
                     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 #46"></div>
  </section>
</div>
    <div class="postbit" id="82534" data-post-id="82534">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote group-livebook_core_team" data-username="josevalim" data-post="45" data-topic="14302">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/josevalim/48/1787_2.png" class="avatar"> josevalim:</div>
<blockquote>
<p>In fact, all of the alternatives brought up so far, such as command line application configuration, is not related to compile-time configuration, but rather to runtime configuration.</p>
</blockquote>
</aside>
<p>Eh, only in so far as mix is ‘running’ like <code>ELIXIR_BLAH='something' mix compile</code> or <code>mix compile -DELIXIR_BLAH=something</code> or so.</p>
<aside class="quote group-livebook_core_team" data-username="josevalim" data-post="47" data-topic="14302">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/josevalim/48/1787_2.png" class="avatar"> josevalim:</div>
<blockquote>
<p>The reason the confusion exists is because the compile/runtime is completely irrelevant for Mix but it exists in a release.</p>
</blockquote>
</aside>
<p>Actually the definition is intensely important in normal code as well.  Like the URL for the <code>ueberauth_cas</code> library gets hardcoded into the compiled code at compile time from the config, when it by all accounts should be runtime changeable (and I had to have it to that, hence forked).  Yes this is a library issue, but the current style ‘encourages’ this usage, which is a big problem.</p>
<aside class="quote group-livebook_core_team" data-username="josevalim" data-post="47" data-topic="14302">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/josevalim/48/1787_2.png" class="avatar"> josevalim:</div>
<blockquote>
<p>Unless we strictly impose Mix to be a compile-time config only. This means that <code>MIX_ENV=prod PORT=4040 mix run</code> won’t have any effect if the project was already compiled with <code>PORT=8080</code> .</p>
</blockquote>
</aside>
<p>Except an environment variable should take precedence over a higher staged default value, thus 4040 should be used over the 8080 unless the code does something highly irritating like bake it into the compiled beam (which, again, is what the current config system encourages people to do)…</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="82534" 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/proposal-moving-towards-discoverable-config-files/14302/48">Post #47</a>
	                </div>
	            </div>
              <div id="likers-container-82534" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="82534"
                     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 #47"></div>
  </section>
</div>
    <div class="postbit" id="82539" data-post-id="82539">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I am not a big fan of adding any complexity to the <code>mix.exs</code> file I would prefer to go with the <code>on_boot</code> macro and keep all the config related code in the config files.</p>
<p>I am kind of worry about library creators adding the configuration to their <code>mix.exs</code> file.</p>
<p>How that would work then?</p>
<p>Right now it is simple and I dont worry about config files in my deps because they are not being used.</p>
<p>Are you gonna ignore that config as well?</p>
<p>That is my main concern when you push anything to the <code>mix.exs</code> file instead of living it in the config files.</p>
<p>But again going back to the first sentences, no <code>mix.exs</code> has metadata that shouldn’t be important for must of the library packages and I would love to keep it that way.</p>
<p>And is better to rely on copy-paste configs than <strong>library authors handling all possible use cases for the configs</strong> this is my biggest concern.</p>
<aside class="quote no-group" data-username="bitwalker" data-post="40" data-topic="14302">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/bitwalker/48/998_2.png" class="avatar"> bitwalker:</div>
<blockquote>
<p>Configuration should be mostly static in nature</p>
</blockquote>
</aside>
<p>Definitely what I expect from configuration perspective, but</p>
<p><code>config_path</code> or <code>config_files</code> because it seems that every config is actually a file, no a folder so that confuse me from language perspective. Sorry for the dumb question.</p>
<aside class="quote no-group" data-username="hubertlepicki" data-post="14" data-topic="14302">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/hubertlepicki/48/6822_2.png" class="avatar"> hubertlepicki:</div>
<blockquote>
<p>For the simple umbrellas many people would be happy with just top-level config files</p>
</blockquote>
</aside>
<p>Just a comment: Only for production release, I wouldn’t like to have my <code>test</code> configs per app in the root of the umbrella app (it becomes too large with small benefits)</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="82539" 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/proposal-moving-towards-discoverable-config-files/14302/49">Post #48</a>
	                </div>
	            </div>
              <div id="likers-container-82539" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="82539"
                     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 #48"></div>
  </section>
</div>
    <div class="postbit" id="82541" data-post-id="82541">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Standalone preferences so far,</p>
<p>Add macros to the config files like <code>on_boot</code>.</p>
<p>DevOps and engineers have one place to deal with configuration issues and library authors do not have to deal with configurations for you specific use case (unless you ignore every config from the <code>mix.exs</code> proposed so far)</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="82541" 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/proposal-moving-towards-discoverable-config-files/14302/50">Post #49</a>
	                </div>
	            </div>
              <div id="likers-container-82541" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="82541"
                     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 #49"></div>
  </section>
</div>
    <div class="postbit" id="82556" data-post-id="82556">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="josevalim" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/josevalim/120/1787_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  josevalim
                      <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 class="user-title">
									<span>Creator of Elixir</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="OvermindDL1" data-post="48" data-topic="14302">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/overminddl1/48/2677_2.png" class="avatar"> OvermindDL1:</div>
<blockquote>
<p>Yes this is a library issue, but the current style ‘encourages’ this usage, which is a big problem.</p>
</blockquote>
</aside>
<p>Exactly. The only time a user cares about runtime/compile is when they want to configure something compile-time at runtime. <code>on_boot</code> would make those cases clearer, hence this discussion. If in the future we add metadata to applications that allow them to tell which configuration happens at compile-time, we would even be able to catch those errors programatically early on.</p>
<p>In any case, it is likely that the configuration you mentioned shouldn’t even be in the application environment at all, regardless if it is compile-time or runtime. Because even if you move something to be a runtime configuration, it is still a global setting, that we want to avoid nonetheless. Hence the latest recommendations in the library guidelines.</p>
<p>At the end of the day, the fact there are some illegitimate cases of compile-time configuration does not imply that they aren’t legitimate cases for compile-time configuration. Those are quite common and we are not breaking them. <strong>If we want to make it harder to leverage compile-time configuration, then we need to make it harder for library authors, not users</strong>. We shouldn’t “punish” users because of mistakes library authors make.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="82556" data-batch-url="/posts/batch_likers">
                        5
                      </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/proposal-moving-towards-discoverable-config-files/14302/51">Post #50</a>
	                </div>
	            </div>
              <div id="likers-container-82556" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="82556"
                     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 #50"></div>
  </section>
</div>
    <div class="postbit" id="82557" data-post-id="82557">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group quote-modified" data-username="OvermindDL1" data-post="42" data-topic="14302">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/overminddl1/48/2677_2.png" class="avatar"> OvermindDL1:</div>
<blockquote>
<blockquote>
<p>Currently, the <code>{:system ,value}</code> tuple exists as a de-facto standard in many situations.</p>
</blockquote>
<p>No, no it’s not, it would be nice if it was, and sure the usual phoenix/ecto and so forth libraries support it, but so <em>so</em> very few third-parties support it.</p>
</blockquote>
</aside>
<p>You’re definitely right about that, I agree that it is not used consistently enough. The point I was trying to make is, that it is an already existing, elegant and simple possibility of solving a large part of the issue at hand. - Albeit not as clean as solutions proposed here.</p>
<aside class="quote no-group quote-modified" data-username="OvermindDL1" data-post="42" data-topic="14302">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/overminddl1/48/2677_2.png" class="avatar"> OvermindDL1:</div>
<blockquote>
<blockquote>
<p>However, it is usually only used in the production environment.</p>
</blockquote>
<p>I don’t see why? I use the system environment excessively for production and development (and rarely, but occasional on test too).</p>
</blockquote>
</aside>
<p>I assume this is mostly because a lot of people try to stick to paradigms set by the “big players” in terms of frameworks / libraries and follow the phoenix style of splitting configs per-env, which allows for hard-coding those parameters for development environments. Personally, I agree with you, I use environment variables for configuration in development as well.</p>
<aside class="quote no-group" data-username="OvermindDL1" data-post="42" data-topic="14302">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/overminddl1/48/2677_2.png" class="avatar"> OvermindDL1:</div>
<blockquote>
<p>I could do <code>ELIXIR_CONFIG=prod.json mix phx.server</code> or so to specify some things to override the internal config defaults…</p>
</blockquote>
</aside>
<p>This is actually a very interesting idea, imo. It would allow for extending the current possibilities in a much more dynamic way without adding bloat and complication to the <code>mix.exs</code> file.</p>
<hr>
<aside class="quote no-group" data-username="bitwalker" data-post="43" data-topic="14302">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/bitwalker/48/998_2.png" class="avatar"> bitwalker:</div>
<blockquote>
<p>People have had a tendency to use <code>config.exs</code> for <em>all</em> configuration, compile-time (i.e. baked into the build), runtime global, and runtime local (i.e. really should be a parameter to a supervisor spec, or a function, but is instead read from the app env).</p>
</blockquote>
</aside>
<p>This is probably the most important point of what sparked the need for a proposal like this. I can’t help but think that introducing a parallel mechanism for doing things (<code>Application.config</code>) will add more complexity than required. The current set of tools <strong>would</strong> already suffice for solving this issue, if only we would come to an agreement on how to split those entirely different parts of configuration.</p>
<aside class="quote group-livebook_core_team" data-username="josevalim" data-post="45" data-topic="14302">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/josevalim/48/1787_2.png" class="avatar"> josevalim:</div>
<blockquote>
<p>I also don’t believe that users should have to know or care if a configuration is compile time or runtime unless they really have to.</p>
</blockquote>
</aside>
<p>I would like to disagree, depending on how libraries are implemented, this difference is crucial to ones understanding of their own configuration. I that regard, I personally think the current way of <em>config option x is compile-time, unless explicitly implemented otherwise</em> is very clear. The big issue is, that most people are not aware how - and a lot of libraries don’t allow - to even use runtime configuration.</p>
<aside class="quote group-livebook_core_team" data-username="josevalim" data-post="45" data-topic="14302">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/josevalim/48/1787_2.png" class="avatar"> josevalim:</div>
<blockquote>
<p>I will be straight-forward here: this is out of discussion. <code>config.exs</code> is executed at compilation time.</p>
</blockquote>
</aside>
<aside class="quote group-livebook_core_team" data-username="josevalim" data-post="47" data-topic="14302">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/josevalim/48/1787_2.png" class="avatar"> josevalim:</div>
<blockquote>
<p>Unless we strictly impose Mix to be a compile-time config only. This means that <code>MIX_ENV=prod PORT=4040 mix run</code> won’t have any effect if the project was already compiled with <code>PORT=8080</code> . But going down this path feels like we are breaking both approaches, instead of fixing them.</p>
</blockquote>
</aside>
<p>Yep. As someone who has working tooling for my applications in place, a change like this would be terrible. We are trying to solve an issue that is <em>not ideal</em>, it’s not something that’s <em>broken</em>, thus adding possibilities instead of just replacing working solutions would definitely be <strong>the</strong> way to go.</p>
<aside class="quote group-livebook_core_team" data-username="josevalim" data-post="51" data-topic="14302">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/josevalim/48/1787_2.png" class="avatar"> josevalim:</div>
<blockquote>
<p>Exactly. The only time a user cares about runtime/compile is when they want to configure something compile-time at runtime.</p>
</blockquote>
</aside>
<p>Exactly. I think <a class="mention" href="/u/overminddl1" rel="nofollow">@OvermindDL1</a>’s proposal for dynamically importing one other configuration file would be an awesome solution for adding this possibility without introducing unnecessary complexity.</p>
<ul>
<li>The user can still use <code>config/{config|env}.exs</code> for compile-time config</li>
<li>The user can still use <code>System.get_env/1</code> etc. there, not breaking existing configs</li>
<li>The user is more aware of the static nature of those configurations</li>
<li>The user can explicitly pick a config without additional code</li>
</ul>
<p><strong>tl;dr</strong>: I really like <code>RUNTIME_CONFIG=config/myconfig.exs bin/myapp start</code></p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="82557" 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/proposal-moving-towards-discoverable-config-files/14302/52">Post #51</a>
	                </div>
	            </div>
              <div id="likers-container-82557" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="82557"
                     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 #51"></div>
  </section>
</div>
    <div class="postbit" id="82558" data-post-id="82558">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="sasajuric" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/sasajuric/120/991_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  sasajuric
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Author of Elixir In Action</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote group-livebook_core_team" data-username="josevalim" data-post="51" data-topic="14302">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/josevalim/48/1787_2.png" class="avatar"> josevalim:</div>
<blockquote>
<p>At the end of the day, the fact there are some illegitimate cases of compile-time configuration does not imply that they aren’t legitimate cases for compile-time configuration.</p>
</blockquote>
</aside>
<p>Personally I believe that a lot of the stuff which is managed by <code>config.exs</code> &amp; friends belongs to the code. For example <a href="https://github.com/sasa1977/erlangelist/blob/8467056729108b368484d71e9ff89da415434425/site/lib/erlangelist_web/endpoint_config.ex#L24-L61" rel="noopener nofollow ugc">these</a> are params which <code>mix phx.new</code> by default pushes into config script, spread across four files, bundled with unrelated data, but detached from the place where it logically belongs.</p>
<p>Why should by default this data reside in config scripts, and why at runtime must it sit in a public global mutable storage in a separate memory space?</p>
<aside class="quote group-livebook_core_team" data-username="josevalim" data-post="51" data-topic="14302">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/josevalim/48/1787_2.png" class="avatar"> josevalim:</div>
<blockquote>
<p>We shouldn’t “punish” users because of mistakes library authors make.</p>
</blockquote>
</aside>
<p>No, but we could guide users to use approaches which make sense. I think that a lot of misuse of config scripts originates from the fact that generators promote them by default.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="82558" data-batch-url="/posts/batch_likers">
                        5
                      </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/proposal-moving-towards-discoverable-config-files/14302/53">Post #52</a>
	                </div>
	            </div>
              <div id="likers-container-82558" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="82558"
                     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 #52"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <a class="load-more-button" data-turbo-stream="true" href="/topics/14302/load_more?page=6">Load more posts</a>
</div></template></turbo-stream>