fix: require compile-time global resource config#147
Open
tfwright wants to merge 1 commit into
Open
Conversation
Global resource config (everything in `base_configs_schema/0` except `ecto_repo`) is now read at compile time at the application level, so misconfigurations surface at build time and the value used by the running app cannot diverge from what was validated. Previously only `create_with` and `update_with` were compile-time for the conflict check; everything else fell back to `Application.get_env` at runtime. A boot check raises if any of these keys differs between compile and runtime env, pointing the user to `config/config.exs`.
018e867 to
d9817a6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
base_configs_schema/0exceptecto_repo) is captured viaApplication.compile_envin thelive_adminmacro and passed tobuild_session/4.Application.get_envis no longer used as a fallback for these keys.LiveAdmin.Application.start/2calls a newvalidate_compile_time_config!/0that compares each key's compile-time value to the current runtime value and raises on mismatch, pointing the user toconfig/config.exs.base_configs_schema/0docstring now spell out which app-level keys are compile-time and which (ecto_repo,session_store,gettext_backend,css_overrides) stay runtime.Test plan
mix test(44 tests, 0 failures) — includes newbuild_session/4describes covering app_config lookup, runtime env being ignored, and list defaults, plusLiveAdmin.ApplicationTestcovering the boot-time mismatch raise.mix compile --warnings-as-errorsmix credo— no new violationsmix dev) after merge to confirm:immutable_fieldsconfigured viaApplication.put_envbefore the demo router compiles still flows through