Skip to content

Commit

Permalink
Merge pull request #71 from CanDIG/daisieh/no-listen-path
Browse files Browse the repository at this point in the history
hotfix: hardcode /federation into server urls
  • Loading branch information
daisieh authored Oct 18, 2024
2 parents ea5adb4 + b8db316 commit 2a52429
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion candig_federation/federation.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ def async_requests(self, request, endpoint_path, endpoint_payload, endpoint_serv
response["response"] = f"Safe check abort: {server['server']['id']} is assumed to be down"
else:
# self.announce_fed_out(request_type, url, endpoint_path, endpoint_payload)
url = f"{server['server']['url']}/v1/fanout"
url = f"{server['server']['url']}/federation/v1/fanout"

# spawn each request in a gevent
jobs[server['server']['id']] = gevent.spawn(requests.post, url, json=args, headers=header, timeout=self.timeout)
Expand Down
2 changes: 1 addition & 1 deletion candig_federation/heartbeat.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def check_pulse():
log = ""
try:
for server in servers.values():
url = f"{server['server']['url']}/v1/service-info"
url = f"{server['server']['url']}/hello"
log += f"\ntesting {url}"
service_info = requests.get(url, timeout=2)
if service_info.ok:
Expand Down
3 changes: 3 additions & 0 deletions candig_federation/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ def get_registered_servers():
def register_server(obj):
servers = get_registered_servers()
new_server = obj['server']
if new_server['url'].endswith("/federation"):
new_server['url'].replace("/federation", "")

if servers is not None:
# check to see if it's already here:
found = False
Expand Down
6 changes: 3 additions & 3 deletions tests/test_data/test_structs.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ def headers(self):
"PORT2": "8892",
"Headers": exampleHeaders,
"Federate": fedHeader,
"Tyk1": "10.9.208.132:6000/v1/fanout",
"Tyk2": "10.9.208.132:8000/v1/fanout",
"Tyk3": "10.9.208.132:9000/v1/fanout",
"Tyk1": "10.9.208.132:6000/federation/v1/fanout",
"Tyk2": "10.9.208.132:8000/federation/v1/fanout",
"Tyk3": "10.9.208.132:9000/federation/v1/fanout",
"path": "rnaget/projects",
"service": "rnaget",
}
Expand Down

0 comments on commit 2a52429

Please sign in to comment.