From 3403c67ea0ee15b54463355d2327c9328b751653 Mon Sep 17 00:00:00 2001 From: Kevin Musselman Date: Mon, 23 Mar 2020 13:39:30 -0400 Subject: [PATCH] update beacon port --- ancilla/ancilla/app.py | 3 ++- ancilla/ancilla/foundation/node/discovery/beacon.py | 2 +- ancilla/ancilla/foundation/node/discovery/discovery.py | 2 +- ancilla/ancilla/foundation/node/node_service.py | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/ancilla/ancilla/app.py b/ancilla/ancilla/app.py index 4f74346..e931d0b 100644 --- a/ancilla/ancilla/app.py +++ b/ancilla/ancilla/app.py @@ -102,7 +102,8 @@ def _start_dev(self): def _start_prod(self): print("START PROD") - self.node_server = NodeService() # NodeServer() + api_port = int(os.environ.get("API_PORT", 5000)) + self.node_server = NodeService(api_port=api_port) self.api_server = APIServer(self.document_store, self.node_server) self.api_server.start() # self.node_server = NodeService() # NodeServer() diff --git a/ancilla/ancilla/foundation/node/discovery/beacon.py b/ancilla/ancilla/foundation/node/discovery/beacon.py index 2b13663..5f59a82 100644 --- a/ancilla/ancilla/foundation/node/discovery/beacon.py +++ b/ancilla/ancilla/foundation/node/discovery/beacon.py @@ -63,7 +63,7 @@ def update_record(self, zeroconf, now, record): class Beacon(object): - def __init__(self, name="Ancilla", port=5000, address=None, *args, **kwargs): + def __init__(self, name="Ancilla", port=80, address=None, *args, **kwargs): self.conf = Zeroconf() # self.conf.unregister_all_services() self.registered = False diff --git a/ancilla/ancilla/foundation/node/discovery/discovery.py b/ancilla/ancilla/foundation/node/discovery/discovery.py index 130dc16..b42a6db 100644 --- a/ancilla/ancilla/foundation/node/discovery/discovery.py +++ b/ancilla/ancilla/foundation/node/discovery/discovery.py @@ -268,7 +268,7 @@ def check_network(self): def update_beacon(self, adr): try: print(f'Updating Beacon {self.current_address}, New: {adr}') - self.beacon = Beacon(self.node.name, address=adr) + self.beacon = Beacon(self.node.name, port=self.node.api_port, address=adr) self.beacon.update_network(self.node.settings.discovery, self.node.settings.discoverable) self.current_address = adr except Exception as e: diff --git a/ancilla/ancilla/foundation/node/node_service.py b/ancilla/ancilla/foundation/node/node_service.py index ae79407..7a00676 100644 --- a/ancilla/ancilla/foundation/node/node_service.py +++ b/ancilla/ancilla/foundation/node/node_service.py @@ -43,7 +43,7 @@ class NodeService(App): # _api_port = 5000 - def __init__(self, api_port=5000): + def __init__(self, api_port): super().__init__() # self.api_port = api_port self.__api_port = api_port