mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-16 22:43:00 +00:00
make spawner IP configurable
mainly for localhost->127.0.0.1 config in pathological cases
This commit is contained in:
@@ -65,7 +65,7 @@ class Server(Base):
|
||||
__tablename__ = 'servers'
|
||||
id = Column(Integer, primary_key=True)
|
||||
proto = Column(Unicode, default='http')
|
||||
ip = Column(Unicode, default='localhost')
|
||||
ip = Column(Unicode, default='')
|
||||
port = Column(Integer, default=random_port)
|
||||
base_url = Column(Unicode, default='/')
|
||||
cookie_name = Column(Unicode, default='cookie')
|
||||
|
@@ -41,6 +41,9 @@ class Spawner(LoggingConfigurable):
|
||||
user = Any()
|
||||
hub = Any()
|
||||
api_token = Unicode()
|
||||
ip = Unicode('localhost', config=True,
|
||||
help="The IP address (or hostname) the single-user server should listen on"
|
||||
)
|
||||
start_timeout = Integer(60, config=True,
|
||||
help="""Timeout (in seconds) before giving up on the spawner.
|
||||
|
||||
@@ -142,10 +145,11 @@ class Spawner(LoggingConfigurable):
|
||||
'--port=%i' % self.user.server.port,
|
||||
'--cookie-name=%s' % self.user.server.cookie_name,
|
||||
'--base-url=%s' % self.user.server.base_url,
|
||||
|
||||
'--hub-prefix=%s' % self.hub.server.base_url,
|
||||
'--hub-api-url=%s' % self.hub.api_url,
|
||||
]
|
||||
if self.ip:
|
||||
args.append('--ip=%s' % self.ip)
|
||||
if self.notebook_dir:
|
||||
args.append('--notebook-dir=%s' % self.notebook_dir)
|
||||
if self.debug:
|
||||
@@ -321,6 +325,8 @@ class LocalProcessSpawner(Spawner):
|
||||
@gen.coroutine
|
||||
def start(self):
|
||||
"""Start the process"""
|
||||
if self.ip:
|
||||
self.user.server.ip = self.ip
|
||||
self.user.server.port = random_port()
|
||||
cmd = []
|
||||
env = self.env.copy()
|
||||
|
Reference in New Issue
Block a user