Add hosts settings and some validation logic #228
+41
−1
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.
It is common in application to need the host, for example for redirect callbacks using oauth, or for automated CORS restrictions, etc.
This PR adds the host settings and introduces a pattern for settings validation based on environments. Within this pattern validation it adds helpful checks over CORS and the definition of hosts for staging and production.
It is important to show that the pattern also does not fix things for the user or performs changes to their settings based on other settings, i have always found that is better to give the feedback to the user and let the user decide instead of performing modifications at runtime without visibility to the user. That is why in the validation there should only be messages warnings/errors and no modification of the settings.