mirror of
https://github.com/easydiffusion/easydiffusion.git
synced 2024-12-26 17:08:54 +01:00
Fix #1333 - listen_port isn't always present in the config file
This commit is contained in:
parent
9a0031c47b
commit
e23f66a697
@ -338,21 +338,22 @@ def get_image_internal(task_id: int, img_id: int):
|
|||||||
class CloudflareTunnel:
|
class CloudflareTunnel:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
config = app.getConfig()
|
config = app.getConfig()
|
||||||
self.Urls = None
|
self.urls = None
|
||||||
self.port = config["net"]["listen_port"]
|
self.port = config.get("net", {}).get("listen_port")
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
self.Urls = try_cloudflare(self.port)
|
if self.port:
|
||||||
|
self.urls = try_cloudflare(self.port)
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
if self.Urls != None:
|
if self.urls:
|
||||||
try_cloudflare.terminate(self.port)
|
try_cloudflare.terminate(self.port)
|
||||||
self.Urls = None
|
self.urls = None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def address(self):
|
def address(self):
|
||||||
if self.Urls != None:
|
if self.urls:
|
||||||
return self.Urls.tunnel
|
return self.urls.tunnel
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user