@@ -817,6 +817,9 @@ async def publish_loop(self):
817
817
await self .send (* msg )
818
818
819
819
async def start (self , address , port , verbose = True , call_on_start = None ):
820
+ await self .start_multi_address ([(address , port )], call_on_start = call_on_start )
821
+
822
+ async def start_multi_address (self , addresses , call_on_start = None ):
820
823
runner = web .AppRunner (self .app , access_log = None )
821
824
await runner .setup ()
822
825
ssl_ctx = None
@@ -827,17 +830,26 @@ async def start(self, address, port, verbose=True, call_on_start=None):
827
830
keyfile = args .tls_keyfile )
828
831
scheme = "https"
829
832
830
- site = web .TCPSite (runner , address , port , ssl_context = ssl_ctx )
831
- await site .start ()
833
+ logging .info ("Starting server\n " )
834
+ for addr in addresses :
835
+ address = addr [0 ]
836
+ port = addr [1 ]
837
+ site = web .TCPSite (runner , address , port , ssl_context = ssl_ctx )
838
+ await site .start ()
839
+
840
+ if not hasattr (self , 'address' ):
841
+ self .address = address #TODO: remove this
842
+ self .port = port
843
+
844
+ if ':' in address :
845
+ address_print = "[{}]" .format (address )
846
+ else :
847
+ address_print = address
832
848
833
- self .address = address
834
- self .port = port
849
+ logging .info ("To see the GUI go to: {}://{}:{}" .format (scheme , address_print , port ))
835
850
836
- if verbose :
837
- logging .info ("Starting server\n " )
838
- logging .info ("To see the GUI go to: {}://{}:{}" .format (scheme , address , port ))
839
851
if call_on_start is not None :
840
- call_on_start (scheme , address , port )
852
+ call_on_start (scheme , self . address , self . port )
841
853
842
854
def add_on_prompt_handler (self , handler ):
843
855
self .on_prompt_handlers .append (handler )
0 commit comments