-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
265176b
commit f96e188
Showing
5 changed files
with
30 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
def parse_request(req) -> tuple: | ||
port = req.headers.get("Port") | ||
host = req.headers.get("Host") | ||
ip_address = host.split(":")[0] | ||
return ip_address, port |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# routes.py | ||
from flask import Blueprint, request | ||
from app.common import parse_request | ||
from app.cosmos.cosmos import cosmos_health | ||
from app.ethereum.ethereum import ethereum_health | ||
|
||
api = Blueprint("api", __name__) | ||
|
||
|
||
@api.route("/ethereum", methods=["GET"]) | ||
def ethereum_health_check(): | ||
ip, port = parse_request(request) | ||
message, status = ethereum_health(ip, port) | ||
return message, status | ||
|
||
|
||
@api.route("/cosmos", methods=["GET"]) | ||
def cosmos_health_check(): | ||
ip, port = parse_request(request) | ||
message, status = cosmos_health(ip, port) | ||
return message, status |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters