-
Notifications
You must be signed in to change notification settings - Fork 317
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support of using custom env variables #1448
Open
AnastasiaSliusar
wants to merge
23
commits into
jupyter-server:main
Choose a base branch
from
AnastasiaSliusar:custom-env-variables
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 6 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
97747e6
Add support of custom env variables
AnastasiaSliusar 887f522
Fix description of a flag
AnastasiaSliusar 63e634e
fix custom env vars
AnastasiaSliusar 9355a31
Cleaned code
AnastasiaSliusar 2ee8b19
Fix code styling
AnastasiaSliusar 86ddf23
Merge branch 'main' into custom-env-variables
AnastasiaSliusar ae37186
Fix type
AnastasiaSliusar 93b14be
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 4b04556
Fix types
AnastasiaSliusar ef07d15
Resolve conflicts
AnastasiaSliusar 084b5ba
Merge branch 'custom-env-variables' of https://github.com/AnastasiaSl…
AnastasiaSliusar 0c49734
Remove custom page config
AnastasiaSliusar ba231eb
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 56a6b42
Add a test, clean code
AnastasiaSliusar b0feeba
Merge branch 'custom-env-variables' of https://github.com/AnastasiaSl…
AnastasiaSliusar 6bea16b
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 90418ca
Fix formatting
AnastasiaSliusar c1c84c8
Merge branch 'custom-env-variables' of https://github.com/AnastasiaSl…
AnastasiaSliusar 9a9958a
Merge remote-tracking branch 'upstream/main' into custom-env-variables
AnastasiaSliusar f1c3d55
Update a variable name
AnastasiaSliusar 01db90a
Fix lint
AnastasiaSliusar e51f647
Fix setuping custom env vars
AnastasiaSliusar 4d48ec4
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -401,6 +401,8 @@ def init_settings( | |
# collapse $HOME to ~ | ||
root_dir = "~" + root_dir[len(home) :] | ||
|
||
self.allow_custom_env_variables = jupyter_app.allow_custom_env_variables | ||
|
||
settings = { | ||
# basics | ||
"log_function": log_request, | ||
|
@@ -460,6 +462,7 @@ def init_settings( | |
"server_root_dir": root_dir, | ||
"jinja2_env": env, | ||
"serverapp": jupyter_app, | ||
"page_config_hook": (self.page_config_hook), | ||
} | ||
|
||
# allow custom overrides for the tornado web app. | ||
|
@@ -470,6 +473,10 @@ def init_settings( | |
settings["xsrf_cookie_kwargs"] = {"path": base_url} | ||
return settings | ||
|
||
def page_config_hook(self, handler, page_config): | ||
page_config["allow_custom_env_variables"] = self.allow_custom_env_variables | ||
return page_config | ||
|
||
def init_handlers(self, default_services, settings): | ||
"""Load the (URL pattern, handler) tuples for each component.""" | ||
# Order matters. The first handler to match the URL will handle the request. | ||
|
@@ -1427,6 +1434,12 @@ def _default_allow_remote(self) -> bool: | |
""", | ||
) | ||
|
||
allow_custom_env_variables = Bool( | ||
False, | ||
config=True, | ||
help="""Allow to use custom env variables""", | ||
) | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this trait name and description is too vague. Since this is specifically about passing custom environment variables to the kernel, I think we need to clarify in this trait and help message that we mean kernel env vars here. |
||
browser = Unicode( | ||
"", | ||
config=True, | ||
|
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
page_config is a concept specific to JupyterLab. Up until this point, Jupyter Server has been agnostic to it. This hook might need to land in jupyterlab_server instead, which extends jupyter_server and brings the page_config concept to the server.