Repository navigation
Fix/95 installer rpc route paths - #102
Open
thomasgarrett455 wants to merge 2 commits into
Open
thomasgarrett455 wants to merge 2 commits into
thomasgarrett455 wants to merge 2 commits into
Conversation
This branch has not been deployed
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.
Fixes #95
Problem
On a fresh igniter install the config.exs would get default endpoints but, the router would get
"" as the :run and :validate endpoints, not the default "/rpc/*" endpoints
Root Cause
During the igniter install the new config values are only a pending edit. So, when add_rpc_routes/2 calls Application.get_env/2 it does not have the configured routes.
When no routes are set Application.get_env/2 defaults to nil. Hence, the empty routes in the router file.
The Fix
I added module attributes to the top of the install file to keep config.exs and router fallback in sync.
The 2 literals that were hardcoded in the install file were changed to the attributes. Inside the add_rpc_routes/2
function the defaults are now being passed into Application.get_env/3. These will be used only when
the key isn't already set from the user's configured endpoint.
Tests
Tests were added to ensure:
Notes
Apps already installed with this bug won't be repaired because an empty route ("") that was added by a previous
install will still be counted as a route and therefore the installer will use it as an already configured route.
Contributor checklist
Leave anything that you believe does not apply unchecked.