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


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>After reading through this thread, I’m left wondering what specific problem this proposal is trying to solve, even after it’s been summarized and re-stated several times.</p>
<ol>
<li>
<p>Introducing <code>Application.Config</code> that would work similarly to <code>Mix.Config</code>, but be present within a release where <code>Mix</code> isn’t available.</p>
<p>I haven’t seen much discussion about this point, which perhaps indicates that people would be fine with it, assuming that it all behaves equivalently to the way it does today.</p>
<p>I personally think it would be an improvement if we didn’t have config files being included dynamically, because it tends to make it difficult to figure out what the final value will be, based on several files including each other. It seems that this is more likely to be the case for Nerves-based projects than for others because we often like to work on pieces of the system on our laptops, only using Nerves to deploy the firmware to a real device at the end. That can lead to configuration file trees that pull in different files depending on whether you’re <a href="https://github.com/GregMefford/omni_eye/blob/8e00c803fbcadf2fa412accc94d6434c843f7fe0/eye_fw/config/config.exs" rel="noopener nofollow ugc">running the whole system on the device (using a release)</a> or just <a href="https://github.com/GregMefford/omni_eye/blob/8e00c803fbcadf2fa412accc94d6434c843f7fe0/eye_ui/config/config.exs" rel="noopener nofollow ugc">running the Phoenix-based UI on your laptop (using Mix)</a>. Under the original proposal, I think it would just be a matter of putting something like this in <code>mix.exs</code> for <code>eye_fw</code>:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir"># Note: @target is already set normally in a Nerves-based mix.exs file

config_paths: [
  "../../eye_ui/config/base.exs",
  "../../eye_ui/config/prod.exs",
  "config/config.exs",
  "config/#{@target}"
]
</code></pre>
<p>This seems fine to me. It keeps things pretty explicit as far as the order in which configurations will get applied, and allows me to not have to copy/paste the contents of the config files depending on which thing I’m trying to run.</p>
</li>
<li>
<p>Assuming that the configuration doesn’t rely on <code>Mix</code>, should we apply the same config file both at compile time and runtime. I don’t recall it being specifically stated, but my understanding is that this would be a new step as a release is starting up that would process and execute the configuration somehow <em>before</em> starting any of the <code>Application</code>s in the release, so that they can have their configurations readable using <code>Application.get_env/2</code> exactly as they do today, but based on the run-time environment of the release.</p>
<p>There are a lot of opinions in the thread, and it’s unclear to me whether we’re specifically trying to:</p>
<ul>
<li>
<p>Reduce confusion that people often have initially about whether the <code>config.exs</code> is applied at compile time, runtime, or both.</p>
</li>
<li>
<p>Patch over existing libraries that are doing the “wrong thing,” or allowing/encouraging their users to do the “wrong thing.”</p>
</li>
<li>
<p>Solve the question of how library <em>authors</em> should allow/encourage their users to specify compile-time vs run-time options and settings going forward.</p>
<p>For example, would this problem be solved without making any changes at all to Mix and releases if libraries consistently supported a way for the user to specify that they want to read from an environment variable at runtime (like <code>{:system, "DB_URL"}</code> or just <code>"${DB_URL}"</code>) instead of Mix <em>literally</em> calling <code>System.get_env("DB_URL")</code> in the configuration script at compile time? Could we solve the problem by doing what <code>REPLACE_OS_VARS</code> does, only from inside the release instead of the way it works now by rewriting the release config?</p>
</li>
<li>
<p>Solve the question of how library <em>users</em> should specify settings going forward. In particular, for the common case that they want to read environment variables at run-time and not at compile-time.</p>
</li>
<li>
<p>Handle all the unusual cases people currently have in their <code>config.exs</code> just because it’s there and it’s an executable Elixir script.</p>
</li>
</ul>
</li>
<li>
<p>Assuming that we are going to run the same configuration at compile-time and run-time, should we have a way for the user to <em>only</em> run certain parts of it (via <code>on_boot</code>) or <em>not</em> run certain parts of it (via <code>on_compile</code>).</p>
<p>If the current guidance for library authors is that they should avoid using application configuration, maybe we end up needing <code>config.exs</code> less and less because the docs for the libraries will tell them to pass options into their <code>init</code> callback instead of putting something in <code>config.exs</code>. If that’s the future, then maybe there’s nothing to actually change about the way it works other than libraries, documentation, and community culture.</p>
<p>For example, if the <code>config.exs</code> were only used to declare which environment variable to use and what its default value should be if not set, then it doesn’t matter whether you’re running in a release or not because it’s only declaring <em>the name</em> of the environment variable at both compile time and run time, not its <em>contents</em>. It would be up to the library to substitute the value at the time it needs to.</p>
<p>What I’m getting at here is that maybe we don’t need a generic <code>on_boot</code> macro that can execute arbitrary Elixir code, if the real problem we’re trying to solve is how to declare that we want to read from an environment variable and what the default value should be if it’s not set.</p>
</li>
</ol> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="82637" 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/64">Post #63</a>
	                </div>
	            </div>
              <div id="likers-container-82637" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="82637"
                     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 #63"></div>
  </section>
</div>
    <div class="postbit" id="82664" data-post-id="82664">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>It feels like we’re dealing with a leaky abstraction here.</p>
<p>In some cases configuration will change the code that gets compiled. e.g. A different set of macros will be run and the code generated by a compile-time configuration will have caused that. At other times, the configuration value will be used in code that doesn’t change at compile time. e.g. The host to connect to for an API. In a degenerate case, the value will be inlined as a constant at compile time and you have to go and complain to the library author that the code can’t be run in production… But that’s what the guidelines are for.</p>
<p>As a user I can not be expected to know which configuration will be which of the above scenarios implicitly. The fact that the MySQL Ecto adapter and the Postgrex one produce different compile-time code is “unknowable” to me because it’s based on how those libraries are implemented. You could do the same with log levels where the config changed macros and no-op’ed out everything. Clearly changing those flags at runtime is meaningless.</p>
<p>I guess I’m looking for the Principle of Least Surprise here. Having configuration that modified the code at compile time in a separate location from configuration that only effects runtime and enforced somehow seems like an ideal solution. (an exercise left to the reader. <img src="https://forum.elixirforum.com/images/emoji/apple/smile.png?v=15" title=":smile:" class="emoji" alt=":smile:" loading="lazy" width="20" height="20"> ) It makes the contract explicit and would require the library writer to specify the type of configuration, compile time or runtime, based on the implementation.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="82664" data-batch-url="/posts/batch_likers">
                        6
                      </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/65">Post #64</a>
	                </div>
	            </div>
              <div id="likers-container-82664" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="82664"
                     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 #64"></div>
  </section>
</div>
    <div class="postbit" id="82679" data-post-id="82679">
  <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="GregMefford" data-post="64" 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/gregmefford/48/4875_2.png" class="avatar"> GregMefford:</div>
<blockquote>
<p>After reading through this thread, I’m left wondering what specific problem this proposal is trying to solve, even after it’s been summarized and re-stated several times.</p>
</blockquote>
</aside>
<p>You provided a very good summary of the opinion going around the thread. To answer your bullets:</p>
<ol>
<li>
<p><code>Application.Config</code> exists so we can also load configuration in a release, where Mix is not available. In a way, it is orthogonal to the other topics on this thread. Think of it as a replacement/alternative to conform.</p>
</li>
<li>
<p>The original proposal is about applying the same config file both at compile time and runtime. This would allow us to remove both <code>{:system, "DB_URL"}</code> and the <code>REPLACE_OS_VARS</code> workarounds by literally calling <code>System.get_env("DB_URL")</code>. However, it doesn’t change any of the other bullet items you mentioned, in particular, it doesn’t change how library authors should read from the application environment. It may make some cases worse, for example, unusual things being done a <code>config.exs</code> file will now also run in a release.</p>
</li>
<li>
<p>The <code>on_boot</code> is a half way step from the current proposal where, instead of running the whole config file in both compile-time and a release, a release will run only the <code>on_boot</code> parts. Everything else is assumed to run on compile-time, so there is no <code>on_compile</code>. The original proposal and <code>on_boot</code> aim to solve the same problem, but with different degrees of explicitness.</p>
</li>
</ol>
<p>Excluding <code>Application.Config</code> discussion, we basically have four options:</p>
<ol>
<li>
<p>Run config files only at compile time (this is what happens today). This leaves users empty handed about how to configure their releases</p>
</li>
<li>
<p>Run the same config files at both compile-time and runtime. The issue with this is that any crazy thing happening in a <code>config.exs</code> will now also run in production because there is no distinction what happens during compile time and what happens on boot. If you are doing something “too crazy”, it may even make booting the release fail</p>
</li>
<li>
<p>Run config files only at compile time but allow them to declare chunks of code that should execute at runtime (<code>on_boot</code>). This attempts to circumvent the issues in <code>2</code> and it makes releases and Mix behave a bit closer to each other</p>
</li>
<li>
<p>Run config files only at compile time and introduce a configuration file that is specific to releases where you would put the runtime/on_boot configuration. The issue here is that you may end-up duplicating some of the <code>config/prod.exs</code> in the <code>release_config.exs</code></p>
</li>
</ol>
<aside class="quote no-group" data-username="geofflane" data-post="65" 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/geofflane/48/4489_2.png" class="avatar"> geofflane:</div>
<blockquote>
<p>I guess I’m looking for the Principle of Least Surprise here. Having configuration that modified the code at compile time in a separate location from configuration that only effects runtime and enforced somehow seems like an ideal solution.</p>
</blockquote>
</aside>
<p>If we are talking about leaky abstraction… isn’t that forcing the leaky abstraction onto the users?  <img src="https://forum.elixirforum.com/images/emoji/apple/slight_smile.png?v=15" title=":slight_smile:" class="emoji" alt=":slight_smile:" loading="lazy" width="20" height="20"> As a user, I would love to not have to care about this. Imagine how confusing it will be if every time I want to configure an application I need to figure which one of those buckets I need to put my configuration in. The only case where a <code>user</code> should have to care about this distinction is when they want to configure something that happens at compile-time during runtime.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="82679" 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/66">Post #65</a>
	                </div>
	            </div>
              <div id="likers-container-82679" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="82679"
                     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 #65"></div>
  </section>
</div>
    <div class="postbit" id="82682" data-post-id="82682">
  <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="66" 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>If we are talking about leaky abstraction… isn’t that forcing the leaky abstraction onto the users? <img src="https://forum.elixirforum.com/images/emoji/apple/slight_smile.png?v=15" title=":slight_smile:" class="emoji" alt=":slight_smile:" loading="lazy" width="20" height="20"> As a user, I would love to not have to care about this. Imagine how confusing it will be if every time I want to configure an application I need to figure which one of those buckets I need to put my configuration in.</p>
</blockquote>
</aside>
<p>Given the following:</p>
<ol>
<li>A user can set configuration data with a dynamically executed code</li>
<li>A library might fetch the data at compile time</li>
<li>A library might fetch the data at runtime</li>
</ol>
<p>I don’t think you can hide the context from users. If a library needs the data at compile time, I can’t set it at runtime. And if the user is invoking e.g. <code>System</code> functions, then they might fail if executed in a wrong environment, or return a wrong result.</p>
<p>So I think something has to give here. Either configs are allowed in only one context (either runtime or compile time), or dynamic code is not supported (i.e. only constants can be provided), or users need to be aware of the context and choose where they want to provide the value. But I think that this is exactly what <code>on_boot</code> is solving, right?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="82682" data-batch-url="/posts/batch_likers">
                        6
                      </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/67">Post #66</a>
	                </div>
	            </div>
              <div id="likers-container-82682" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="82682"
                     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 #66"></div>
  </section>
</div>
    <div class="postbit" id="82687" data-post-id="82687">
  <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="sasajuric" data-post="67" 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/sasajuric/48/991_2.png" class="avatar"> sasajuric:</div>
<blockquote>
<p>But I think that this is exactly what <code>on_boot</code> is solving, right?</p>
</blockquote>
</aside>
<p>Yes, exactly. There are multiple ways to solve this problem, <code>on_boot</code> is one of them. <code>on_boot</code> declares the user intent and if we allow library authors to declare what is compile-time and what is runtime, we can use this information and notify the user of any mismatches. Having separate files for runtime configs would have the same effect.</p>
<p>The goal with <code>on_boot</code> is that users do not need to know upfront what goes what. We can use the tooling to automatically detect conflicts. If I could do an analogy, forcing the users to declare what is compile vs runtime upfront would be equivalent to Git requiring me to explicitly merge all commits, even if there are no conflicts. <code>on_boot</code> is about bothering the user only when conflicts are detected. In order for this to work though, we need to increase the burden on library developers, which is fine and probably warranted, since most developers should rely less on compile-time application config anyway.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="82687" 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/68">Post #67</a>
	                </div>
	            </div>
              <div id="likers-container-82687" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="82687"
                     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 #67"></div>
  </section>
</div>
    <div class="postbit" id="82689" data-post-id="82689">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Another idea, which might make the difference between compile-time configuration vs run-time(/on-boot) configuration more clear to the user <em>but only in the instances they have to care about  it</em> is to:</p>
<ul>
<li>Introduce <code>Application.Config</code> which has the same behaviour as <code>Mix.Config</code> but lives in <code>:elixir</code> instead of <code>:mix</code> so it is available in Releases. <small>(as in original proposal)</small></li>
<li>Choose which configuration files (and the order they should have) in the <code>mix.exs</code> file by using a <code>:config_paths</code> key.<small>(as in original proposal)</small></li>
<li><strong>Expose whether we want to look at the application’s <code>mix.exs</code> information for compile-mode or for run-time/boot-time-mode</strong> so that we can in e.g. the implementation of the <code>mix.exs</code>’s <code>project()</code> fields (most importantly: <code>:config_paths</code>) potentially choose between different groups of configuration files. This is very similar to how different Mix environments are currently used to e.g. switch between what dependencies you include.</li>
<li>Using <code>import_config</code> just like you do today (including string-replacements) is still allowed, but we might decide to deprecate this feature, and <em>definitely</em> show warnings (or potentially hard errors) when the configuration file that was linked to can not currently be found because its string replacement was ‘too smart’, and point the user towards the new way to configure their application using a conditional <code>config_paths:</code> list.</li>
</ul>
<p>I think that when we would set it up like this, the abstraction is the least leaky.<br>
Example usage:</p>
<ol>
<li>A user that starts an Elixir project does not need to care about the difference between compile-time and run-time because exactly the same configuration is read by default (because the value for <code>:config_paths</code> is constant)</li>
<li>If they start using Releases and find out that they want to perform some configuration differently at boot-time, they can change <code>:config_paths</code>.</li>
<li>If they try to use configuration that is ‘too smart’ to work on boot, we can in most cases generate a warning during compilation-time (and otherwise a hard error during boot time) that should tell the user to rewrite the configuration using a conditional <code>:config_paths</code> setup.</li>
</ol>
<p>In the simplest case, it would looke like:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">def project do
[
  ...
  config_paths: ~w(config/config.exs config/#{Mix.env()}.exs)
  ...
]
end
</code></pre>
<p>Expanded to do different things based on compile-time/boot-time mode:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">def project do
[
  ...
  config_paths: ~w{config/base_config.exs} ++ config_paths(Mix.env(), Mix.configuration_target())
  ...
]
end

def config_paths(_, :compile_time), do: ~w{config/compile_time_overrides.exs}
def config_paths(:dev,  :boot_time) do: ~w{config/production_boot_overrides.exs config/production_secrets.exs}
def config_paths(:prod, :boot_time) do: ~w{config/dev_boot_overrides.exs}
</code></pre>
<hr>
<p>This proposed solution is backwards compatible, because:</p>
<ol>
<li>switching in an existing project from <code>Mix.Config</code> to <code>Application.Config</code> is optional (although we probably should make <code>Application.Config</code> the new default for new projects).</li>
<li><code>Mix.Config</code> will just like now work as it always did: Releases only can use it during compiletime, applications running through mix use it at compiletime + boot-time.</li>
<li>When using <code>Application.Config</code>, we look at the <code>:config_paths</code> field in the <code>mix.exs</code> file. This field (and potentially other fields of the <code>project()</code> function) might return different results based on the current <code>Mix.configuration_target()</code> (Maybe we can find a better name for <code>configuration_target</code>?), which will allow Releases to know what files to include for boot-time, and will allow all projects to only expose the correct configuration in the correct configuration environment.</li>
<li><code>Application.Config</code> will complain if <code>import_config</code> is encountered inside a configuration file that is flagged for inclusion into the list of boot-time configuration. <code>Mix.Config</code> will do no such thing and will happily ‘just not work’ on boot-time for a Release.</li>
</ol>
<hr> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="82689" 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/69">Post #68</a>
	                </div>
	            </div>
              <div id="likers-container-82689" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="82689"
                     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 #68"></div>
  </section>
</div>
    <div class="postbit" id="82691" data-post-id="82691">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="arturcygan" data-post="61" 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/arturcygan/48/10050_2.png" class="avatar"> arturcygan:</div>
<blockquote>
<p>I’m no longer sure if we actually need to close the gap between mix project and a release.</p>
</blockquote>
</aside>
<p>Theres the “it worked on my machine” problem - someone can do something wrong but it will still work until deployed - IMO this kind of potential problems must be impossible or as edge as it gets and leaving the distinction is a step in the opposite direction.</p>
<aside class="quote no-group" data-username="Qqwy" data-post="60" 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/qqwy/48/1349_2.png" class="avatar"> Qqwy:</div>
<blockquote>
<p>To me, it thus feels like the current behaviour is implicit, and it can be made more explicit by making it clear that the difference between compile-time configuration and run-time configuration exists (and has always existed!) and needs to be kept in mind.</p>
</blockquote>
</aside>
<p>I second that.</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>Users in this context are programmers, users of the language, right? Then they actually have to care unless we somehow manage to completely remove the under the hood distinction <img src="https://forum.elixirforum.com/images/emoji/apple/slight_smile.png?v=15" title=":slight_smile:" class="emoji" alt=":slight_smile:" loading="lazy" width="20" height="20"> <code>on_boot</code> solution, if adopted, already assumes that users know what it means.</p>
<aside class="quote no-group" data-username="sasajuric" data-post="67" 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/sasajuric/48/991_2.png" class="avatar"> sasajuric:</div>
<blockquote>
<p>Either configs are allowed in only one context (either runtime or compile time), or dynamic code is not supported (i.e. only constants can be provided), or users need to be aware of the context and choose where they want to provide the value. But I think that this is exactly what <code>on_boot</code> is solving, right?</p>
</blockquote>
</aside>
<p>That’s also my understanding but I think the users have to be aware of the context no matter what it is (if configs are only runtime or compile time only).</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="82691" 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/70">Post #69</a>
	                </div>
	            </div>
              <div id="likers-container-82691" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="82691"
                     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 #69"></div>
  </section>
</div>
    <div class="postbit" id="82694" data-post-id="82694">
  <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 no-group" data-username="yurko" data-post="70" 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/yurko/48/2369_2.png" class="avatar"> yurko:</div>
<blockquote>
<p>That’s also my understanding but I think the users have to be aware of the context no matter what it is (if configs are only runtime or compile time only).</p>
</blockquote>
</aside>
<p>Good point. The only time they don’t have to be aware of the context is if there’s no dynamic code (i.e. only constants are provided).</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="82694" 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/71">Post #70</a>
	                </div>
	            </div>
              <div id="likers-container-82694" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="82694"
                     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 #70"></div>
  </section>
</div>
    <div class="postbit" id="82695" data-post-id="82695">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="andre1sk" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/andre1sk/120/1380_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  andre1sk
                  </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="66" 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>Run config files only at compile time and introduce a configuration file that is specific to releases where you would put the runtime/on_boot configuration. The issue here is that you may end-up duplicating some of the <code>config/prod.exs</code> in the <code>release_config.exs</code></p>
</blockquote>
</aside>
<p>Isn’t this a common tradeoff that in Elixir world people tend to err on the side of explicit option  e.g. Phoenix vs Rails design. Would that duplication really be that bad?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="82695" 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/72">Post #71</a>
	                </div>
	            </div>
              <div id="likers-container-82695" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="82695"
                     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 #71"></div>
  </section>
</div>
    <div class="postbit" id="82696" data-post-id="82696">
  <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="andre1sk" data-post="72" 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/andre1sk/48/1380_2.png" class="avatar"> andre1sk:</div>
<blockquote>
<p>Isn’t this a common tradeoff that in Elixir world people tend to err on the side of explicit option e.g. Phoenix vs Rails design. Would that duplication really be that bad?</p>
</blockquote>
</aside>
<p>I don’t think that’s the common trade-off. Why force users to care about a library decision if that is not going to impact them? We should push those concerns to users only when there is a conflict.</p>
<aside class="quote no-group" data-username="sasajuric" data-post="71" 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/sasajuric/48/991_2.png" class="avatar"> sasajuric:</div>
<blockquote>
<p>Good point. The only time they don’t have to be aware of the context is if there’s no dynamic code (i.e. only constants are provided).</p>
</blockquote>
</aside>
<p>Right. The question is: can we move the dynamic code concerns to <code>on_boot</code> (or something similar)?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="82696" 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/73">Post #72</a>
	                </div>
	            </div>
              <div id="likers-container-82696" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="82696"
                     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 #72"></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=8">Load more posts (38 remaining)</a>
</div></template></turbo-stream>