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


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>We chose to solve this problem a different way.</p>
<p>For a while we used things like deferred_config to pull env vars into config at runtime. This worked, but there were setting that we’d like to update while the app was running. We did this by writing a library that uses <code>configparser_ex</code> to parse ini files and <code>file_system</code> to monitor a config directory for changes to ini files. When the library app starts it loads any ini files found and stores the data in an erts table. We have a github checkin hook that will update ini files in production when changes are checked in. The library gets a notification and reloads the ini file that changed and updates erts. This allows us to update config while the application is running.</p>
<p>We treat <code>config/config.exs</code> as compile time settings that don’t change often (or ever.) And all other settings go into the ini files.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="82711" 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/74">Post #73</a>
	                </div>
	            </div>
              <div id="likers-container-82711" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="82711"
                     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 #73"></div>
  </section>
</div>
    <div class="postbit" id="82712" data-post-id="82712">
  <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">
								<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.</p>
</blockquote>
</aside>
<p>I would love to not have to care about it too, so we agree there. But I don’t know that it’s avoidable. Either way, I guess I would rather force us to be explicit and have things work in an understandable way as opposed to things being implicit and wrong in a lot of cases. <code>on_boot</code> is still an explicit mechanism, just one that doesn’t seem obvious to me at first glance.</p>
<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>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>
</blockquote>
</aside>
<p>I guess that is true. If there’s a way for me to look up an item and say “yes this config option can be modified at runtime”, therefore I need to move it somewhere else… I guess, to me, <code>on_boot</code> (or whatever it ends up being called) or a different file doesn’t make a huge difference at that point. I think that passes my test for being explicit. Be default, everything is compile time but some things are made special and become runtime (if applicable).</p> 
	            </div>

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


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I’ve read over this thread, and I have some thoughts about the situation. Why can’t we just keep config files as static, compile-time only configuration, and use the code for runtime config? It seems ideal to me since callbacks like <code>init</code> seem to serve this very purpose. That would make it very explicit as to what is configured at runtime vs. compile time, since you are configuring these things in two different places, as they should be, since runtime config should be part of the code IMO.</p>
<p>It would make a lot more sense and would be more explicit IMO to use <code>System.get_env</code> in your code than in a config file.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="82731" data-batch-url="/posts/batch_likers">
                        9
                      </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/76">Post #75</a>
	                </div>
	            </div>
              <div id="likers-container-82731" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="82731"
                     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 #75"></div>
  </section>
</div>
    <div class="postbit" id="82735" data-post-id="82735">
  <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>What do you guys think about the <code>configuration_target</code> idea that I proposed <a href="https://forum.elixirforum.com/t/proposal-moving-towards-discoverable-config-files/14302/69" rel="nofollow">a couple of posts up</a>?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="82735" 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/77">Post #76</a>
	                </div>
	            </div>
              <div id="likers-container-82735" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="82735"
                     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 #76"></div>
  </section>
</div>
    <div class="postbit" id="82736" data-post-id="82736">
  <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="jswny" data-post="76" 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/jswny/48/18428_2.png" class="avatar"> jswny:</div>
<blockquote>
<p>I’ve read over this thread, and I have some thoughts about the situation. Why can’t we just keep config files as static, compile-time only configuration, and use the code for runtime config?</p>
</blockquote>
</aside>
<p>This is the most recent thing we tried in Phoenix and Ecto via the <code>init/1</code> callback and it caused a lot of confusion because configuration is now broken in two places. So someone would try to set a static flag in their <code>config.exs</code> and nothing would happen. They would spend some time debugging the problem and it turned out that the flag was being overridden in the code with an environment variable.</p>
<p>Although one is runtime and the other is compile-time, they are still configuration, and having them in two completely different places can lead to the confusion I above.</p>
<aside class="quote no-group" data-username="Qqwy" data-post="77" 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>What do you guys think about the <code>configuration_target</code> idea that I proposed <a href="https://forum.elixirforum.com/t/proposal-moving-towards-discoverable-config-files/14302/69" rel="nofollow">a couple of posts up</a>?</p>
</blockquote>
</aside>
<p>It is not much different from having separate files for compile and runtime, which was proposed earlier. It is a valid approach and with more flexibility, but it will likely lead to file explosion too.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="82736" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/proposal-moving-towards-discoverable-config-files/14302/78">Post #77</a>
	                </div>
	            </div>
              <div id="likers-container-82736" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="82736"
                     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 #77"></div>
  </section>
</div>
    <div class="postbit" id="82738" data-post-id="82738">
  <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">
								<aside class="quote group-livebook_core_team quote-modified" data-username="josevalim" data-post="78" 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>
<blockquote>
<p>What do you guys think about the <code>configuration_target</code> idea that I proposed <a href="https://forum.elixirforum.com/t/proposal-moving-towards-discoverable-config-files/14302/69" rel="nofollow">a couple of posts up</a>?</p>
</blockquote>
<p>It is not much different from having separate files for compile and runtime, which was proposed earlier. It is a valid approach and with more flexibility, but it will likely lead to file explosion too.</p>
</blockquote>
</aside>
<p>Indeed, it is similar, but it does solve two issues that the separate-files proposal had:</p>
<ul>
<li>order of file inclusion is more clear because this is explicit in the list of paths.</li>
<li>All of these files are optional so there is less of a file explosion: Creating multiple config files is only necessary once you have configuration that should be specialized to a certain configuration target.</li>
</ul> 
	            </div>

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


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I have a politics related question: how willing is Elixir’s core team to introduce a breaking change that forces everybody to migrate to a seemingly perfect solution (which is yet to be discovered)? This should only come with the next major version however – say, Elixir 1.7.</p>
<p>My experience with people says that they will not change their configuration files for years and will only do so if a version upgrade mandates it. Due to that, it’s my opinion that when the solution is found it definitely should be made very explicit and impossible to ignore. Otherwise a lot of library authors will keep coming up with creatively flawed solutions forever.</p>
<p>What’s your opinion on this political matter?</p>
<p><strong>EDIT</strong>: Obviously, a transitional period with deprecation warnings should be around for a while before a breaking change is introduced.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="82746" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/proposal-moving-towards-discoverable-config-files/14302/80">Post #79</a>
	                </div>
	            </div>
              <div id="likers-container-82746" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="82746"
                     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 #79"></div>
  </section>
</div>
    <div class="postbit" id="82749" data-post-id="82749">
  <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="78" 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>This is the most recent thing we tried in Phoenix and Ecto via the <code>init/1</code> callback and it caused a lot of confusion because configuration is now broken in two places. So someone would try to set a static flag in their <code>config.exs</code> and nothing would happen. They would spend some time debugging the problem and it turned out that the flag was being overridden in the code with an environment variable.</p>
</blockquote>
</aside>
<p>I’ve had such issues myself with just config scripts. In particular I went down a couple of wild goose chases because I didn’t notice an override in another .exs script, or there was an override in the code (either as a compile-time if on <code>Mix.env</code>, or as a runtime if on some other non-obvious global).</p>
<p>Therefore, the problem is IMO not in <code>init/2</code> but in the fact that parameters for endpoint are dispersed across multiple places (which they already were even before <code>init/2</code> was introduced). If on top of it people used one more place for providing parameters, I’m not surprised they were even more confused.</p>
<p>I’d say though that this wasn’t a proper evaluation of <code>init/2</code>. I’d wonder if the people would face the same problems if they provided the complete parameters to the endpoint in a single place (<code>init/2</code> callback).</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="82749" 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/81">Post #80</a>
	                </div>
	            </div>
              <div id="likers-container-82749" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="82749"
                     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 #80"></div>
  </section>
</div>
    <div class="postbit" id="82763" data-post-id="82763">
  <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">
								<aside class="quote group-livebook_core_team" data-username="josevalim" data-post="78" 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>This is the most recent thing we tried in Phoenix and Ecto via the <code>init/1</code> callback and it caused a lot of confusion because configuration is now broken in two places. So someone would try to set a static flag in their <code>config.exs</code> and nothing would happen. They would spend some time debugging the problem and it turned out that the flag was being overridden in the code with an environment variable.</p>
</blockquote>
</aside>
<p>If <a href="https://forum.elixirforum.com/clicks/track?url=https%3A%2F%2Fhexdocs.pm%2Felixir%2Fmaster%2Flibrary-guidelines.html&amp;post_id=82625&amp;topic_id=14302" rel="nofollow">the guidelines for library authors</a> say we should not use application configuration unless strictly necessary, then we should make it less-convenient for them to do that, so that we have less problems with configuration being in multiple places. It feels like the proposal being discussed in this thread makes it easier for both library users and library authors to continue to <em>not</em> follow that advice.</p>
<p>Additionally, introducing a dynamic step that happens before application boot to run your configuration script will introduce a new failure mode that would presumably be outside of the normal supervision hierarchy. This leaves the developer with less opportunity to deal with failures and less opportunity to bring up parts of the system that they want to be online even if the configuration is invalid or some “side-effect” of the configuration script fails on first run, using the normal OTP toolbox that we have today.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="82763" data-batch-url="/posts/batch_likers">
                        4
                      </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/82">Post #81</a>
	                </div>
	            </div>
              <div id="likers-container-82763" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="82763"
                     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 #81"></div>
  </section>
</div>
    <div class="postbit" id="82764" data-post-id="82764">
  <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="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>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>
</blockquote>
</aside>
<p>Precisely indeed.</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>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>
</blockquote>
</aside>
<p>I’m not saying make it harder to ‘define’ configurations for a given stage, but rather it should be made harder to ‘use’ a configuration from the wrong stage.  The onus should be on the library author to do it right, not the library user.</p>
<aside class="quote no-group" data-username="sasajuric" data-post="53" 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>I think that a lot of misuse of config scripts originates from the fact that generators promote them by default.</p>
</blockquote>
</aside>
<p>This this this right here!</p>
<aside class="quote no-group" data-username="sasajuric" data-post="55" 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>I completely agree with <a class="mention" href="/u/michalmuskala" rel="nofollow">@michalmuskala</a> here:</p>
</blockquote>
</aside>
<p>Exactly!  Operator configurations belong in the system environment, not internal to a baked release application or so (thus system environment, external json, JVM’ish XML, whatever…).</p>
<aside class="quote group-livebook_core_team" data-username="josevalim" data-post="56" 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>How would I make it work on both Mix and in a release? Does it mean that I have the line above in my <code>config/prod.exs</code> (which is compile time and Mix based) and then have the same line in a separate runtime config for releases?</p>
</blockquote>
</aside>
<p>I would say yes, or rather have a runtime configuration delegate to the build-time configuration if not otherwise specified (thus giving a nice fallback order).</p>
<aside class="quote group-livebook_core_team" data-username="josevalim" data-post="56" 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 config scripts are not the root cause. What is being misused is the application environment. The fault is in library authors using application environment or forcing compile time configurations when they don’t have to.</p>
</blockquote>
</aside>
<p>An issue here though is that the config scripts dump into the application environment regardless, mixing up build time and run time configurations, which is why it is so easy to mis-use one that should, for example, be a run-time config at compile-time (like say a port number), this is because the interface to access both are identical when their stages are not the same.</p>
<aside class="quote group-livebook_core_team" data-username="josevalim" data-post="56" 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>That’s why I am saying I would rather push the complexity to library authors.</p>
</blockquote>
</aside>
<p>Yes, definitely this, the interface needs to be different to get each stage’s configurations.</p>
<p>And honestly even run-time should not be able to access compile-time’s configurations either (just like how mix is not available at run-time, or not supposed to be anyway).</p>
<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>There is a <code>sys.config</code> which could be treated as static “readonly” config</p>
</blockquote>
</aside>
<p>I actually edit this file fairly often to change boot-up configs…  &gt;.&gt;</p>
<aside class="quote group-Nerves-Core-Team" data-username="ConnorRigby" data-post="62" 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/connorrigby/48/5964_2.png" class="avatar"> ConnorRigby:</div>
<blockquote>
<p>The other thing that i would like to point out is that in my Nerves based projects i often find the need to not only retrieve config at runtime but also set it. For the most part i use something like Ecto/Sqlite for this, but i do have a bad habit of storing data globally in <code>Application.put_env</code> and getting it with <code>Application.get_env</code> .</p>
</blockquote>
</aside>
<p>Same here, and the fact that almost no library responds to change made here is maddening, I have to kill entire process trees to get them to update (if they even update, which they won’t unless they do stupid things like baking it into the source by accessing the config at compile-time for something that <em>should</em> be run-time) or I have to restart the whole VM (which is when I just edit <code>sys.config</code> then…).</p>
<aside class="quote group-Nerves-Core-Team" data-username="ConnorRigby" data-post="62" 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/connorrigby/48/5964_2.png" class="avatar"> ConnorRigby:</div>
<blockquote>
<h3>Building a generic Elixir application</h3>
<p>To me this is where the current system shines in my opinion. I don’t have many complaints with the caveat that i don’t usually “deploy” these applications. (so no distillery, or similar).</p>
</blockquote>
</aside>
<p>I do have complaints here, even something as simple as my discord bot elixir server has hard-coded configs that I have to change at times because of mis-designs in my dependencies that I have to deal with…</p>
<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>Clearly changing those flags at runtime is meaningless.</p>
</blockquote>
</aside>
<p>And yet you ‘can’ do things like change the purge level configuration and people <em>have</em> been surprised that it doesn’t work until they recompile.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="82764" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/proposal-moving-towards-discoverable-config-files/14302/83">Post #82</a>
	                </div>
	            </div>
              <div id="likers-container-82764" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="82764"
                     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 #82"></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=9">Load more posts (28 remaining)</a>
</div></template></turbo-stream>