File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -931,6 +931,9 @@ def _write_cookie_secret_file(self, secret):
931
931
token = Unicode ('<generated>' ,
932
932
help = _ ("""Token used for authenticating first-time connections to the server.
933
933
934
+ The token can be read from the file referenced by JUPYTER_TOKEN_FILE or set directly
935
+ with the JUPYTER_TOKEN environment variable.
936
+
934
937
When no password is enabled,
935
938
the default is to generate a new, random token.
936
939
@@ -945,6 +948,10 @@ def _token_default(self):
945
948
if os .getenv ('JUPYTER_TOKEN' ):
946
949
self ._token_generated = False
947
950
return os .getenv ('JUPYTER_TOKEN' )
951
+ if os .getenv ('JUPYTER_TOKEN_FILE' ):
952
+ self ._token_generated = False
953
+ with io .open (os .getenv ('JUPYTER_TOKEN_FILE' ), "r" ) as token_file :
954
+ return token_file .read ()
948
955
if self .password :
949
956
# no token if password is enabled
950
957
self ._token_generated = False
You can’t perform that action at this time.
0 commit comments