pass allowed query parameters to spawner via user options #805
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.
Firstly, this pull request can wait until a naming scheme for query parameters is decided (#712). I just want to propose a way to pass query parameters from launch url through
user_options
to spawner.This PR introduces a new config
query_parameter_names
which is to be filled with list of allowed query parameter names. With this PR launch url query is appended to build url (/build/<prefix>/<spec>
). And BinderHub usesquery_parameter_names
before launch and checks if they exist in the build url query and passes found ones with their value to spawner'suser_options
(through JupyterHub's api).This PR doesn't do anything with spawner, so default
BinderSpawner
doesn't know how to interpret these new user options. But one can definec.KubeSpawner.pre_spawn_hook
similar to jupyterhub/zero-to-jupyterhub-k8s#1178 (comment):I also added an empty hidden input
user_options
into binder form. When user launches by using form, its value is appended to build url in javascript code. This might be useful when someone has customised binder form template.When a naming scheme is decided, I can make an update to validate
query_parameter_names
config.