From c8d41130e69987d27fa65d274368c93b736a5a28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20M=C3=B6nckemeyer?= Date: Mon, 6 Jul 2020 19:09:58 +0200 Subject: [PATCH 1/3] Added support for JUPYTER_TOKEN_FILE --- notebook/notebookapp.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/notebook/notebookapp.py b/notebook/notebookapp.py index 57833caec0..f72b222af5 100755 --- a/notebook/notebookapp.py +++ b/notebook/notebookapp.py @@ -945,6 +945,10 @@ def _token_default(self): if os.getenv('JUPYTER_TOKEN'): self._token_generated = False return os.getenv('JUPYTER_TOKEN') + if os.getenv('JUPYTER_TOKEN_FILE'): + self._token_generated = False + with io.open(os.getenv('JUPYTER_TOKEN_FILE'), "r") as token_file + return token_file.read() if self.password: # no token if password is enabled self._token_generated = False From e08b300251657ca62fa9efc5121d51c5d94e5883 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20M=C3=B6nckemeyer?= Date: Mon, 6 Jul 2020 19:21:32 +0200 Subject: [PATCH 2/3] Fixed typo --- notebook/notebookapp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/notebook/notebookapp.py b/notebook/notebookapp.py index f72b222af5..d1139fd8a4 100755 --- a/notebook/notebookapp.py +++ b/notebook/notebookapp.py @@ -947,7 +947,7 @@ def _token_default(self): return os.getenv('JUPYTER_TOKEN') if os.getenv('JUPYTER_TOKEN_FILE'): self._token_generated = False - with io.open(os.getenv('JUPYTER_TOKEN_FILE'), "r") as token_file + with io.open(os.getenv('JUPYTER_TOKEN_FILE'), "r") as token_file: return token_file.read() if self.password: # no token if password is enabled From 4d1bdf80273921dd82049778e54a166b4d400b0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20M=C3=B6nckemeyer?= Date: Wed, 22 Jul 2020 19:33:09 +0200 Subject: [PATCH 3/3] Added help description --- notebook/notebookapp.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/notebook/notebookapp.py b/notebook/notebookapp.py index d1139fd8a4..bba3785354 100755 --- a/notebook/notebookapp.py +++ b/notebook/notebookapp.py @@ -931,6 +931,9 @@ def _write_cookie_secret_file(self, secret): token = Unicode('', help=_("""Token used for authenticating first-time connections to the server. + The token can be read from the file referenced by JUPYTER_TOKEN_FILE or set directly + with the JUPYTER_TOKEN environment variable. + When no password is enabled, the default is to generate a new, random token.