Move app config requirement to the top #676
Merged
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.
I was having an issue with the rosetta shard because config files and initializers were loaded after everything in
/src
.Rosetta requires the locales to be loaded and parsed before the app gets loaded. This happens with the
Rosetta::Backend.load("config/rosetta")
macro. Since config files were loaded last, the compiler couldn't find the locale modules, which are generated from an external file using therun
macro. So every single locale raised compiler errors:Simply moving the config requirement to the top of the list in
src/app.cr
fixed the issue. So far, I can't see any problems with this change and I've tested it with two apps.I may be wrong, but to me, it makes more sense to load configuration files before loading the rest of the app. Or am I overlooking anything?