Add support for Flask.host_matching #274
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.
Allows configuration of Flask-DebugToolbar to support a Flask app running in
host_matching
mode.When Flask is configured this way, routes are each tied to a
host
definition. This can either be a single explicit host, or a host definition that includes variable values similar to Werkzeug path definitions, eg<subdomain>.toolbar.com
.Handling explicit domains is simple, as the host can be passed through directly - and this happens automatically.
If the host contains any variable parts, then calls to
url_for
need to be able to access the appropriate values for those variables. If the host string specified by the user contains arbitrary variables, it's difficult for the toolbar to know what those should evaluate to. So we restrict the possible options for the toolbar host to one of two options here: either a single explicit host, or a full-wildcard host. The wildcard host is managed internally by Flask-DebugToolbar so that we know: 1) the variable name, and 2) what value to inject for it (the current request's host).Fix: #269