Skip to content

Commit

Permalink
Merge pull request #3478 from takluyver/disable-terminals
Browse files Browse the repository at this point in the history
Add NotebookApp.terminals_enabled config option
  • Loading branch information
minrk authored Apr 3, 2018
2 parents bf173a8 + 9e8202a commit 70aa9a7
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions notebook/notebookapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -1187,6 +1187,16 @@ def _update_server_extensions(self, change):
"0 (the default) disables this automatic shutdown.")
)

terminals_enabled = Bool(True, config=True,
help=_("""Set to False to disable terminals.
This does *not* make the notebook server more secure by itself.
Anything the user can in a terminal, they can also do in a notebook.
Terminals may also be automatically disabled if the terminado package
is not available.
"""))

def parse_command_line(self, argv=None):
super(NotebookApp, self).parse_command_line(argv)

Expand Down Expand Up @@ -1345,6 +1355,9 @@ def _url(self, ip):
return "%s://%s:%i%s" % (proto, ip, self.port, self.base_url)

def init_terminals(self):
if not self.terminals_enabled:
return

try:
from .terminal import initialize
initialize(self.web_app, self.notebook_dir, self.connection_url, self.terminado_settings)
Expand Down

0 comments on commit 70aa9a7

Please sign in to comment.