Make NotebookApp.ip and .port configurable

Necessary when running Docker with --net=host to avoid unknown port jumps and exposure on all host interfaces

(c) Copyright IBM Corp. 2015
This commit is contained in:
Peter Parente
2015-08-11 16:09:40 -04:00
parent df5cc8d3a6
commit 6ac874bd6b
4 changed files with 13 additions and 5 deletions

View File

@@ -1,12 +1,14 @@
# Copyright (c) IPython Development Team.
# (c) Copyright IBM Corp. 2015
import subprocess
import os
PEM_FILE = os.path.join(os.path.dirname(__file__), 'security/notebook.pem')
c = get_config()
c.NotebookApp.ip = '*'
c.NotebookApp.ip = os.getenv('INTERFACE', '') or '*'
c.NotebookApp.port = int(os.getenv('PORT', '') or 8888)
c.NotebookApp.open_browser = False
c.NotebookApp.port = 8888
# Set a certificate if USE_HTTPS is set to any value
if 'USE_HTTPS' in os.environ: