Skip to content

Commit

Permalink
var
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickmogul committed Sep 24, 2023
1 parent 2d0a4b9 commit f7a2222
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class findora_env:
findora_root_testnet = f"{findora_root}/testnet"
toolbox_location = os.path.join(user_home_dir, "findora-toolbox")
staker_memo_path = os.path.join(user_home_dir, "staker_memo")
our_external_ip = getUrl()
our_external_ip = get_url()
container_name = "findorad"
migrate_dir = os.path.join(user_home_dir, "migrate")
fra_env = "prod"
Expand Down
20 changes: 14 additions & 6 deletions web/src/shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,22 @@
import socket
import requests

def getUrl(timeout=5) -> str:
def get_url(timeout=5) -> str:
try:
response = requests.get("https://ident.me", timeout=timeout)
response = requests.get("https://api.ipify.org?format=json", timeout=timeout)
response.raise_for_status() # Raises a HTTPError if the response was unsuccessful
result = response.text

# Parse the JSON response
ip_data = response.json()
result = ip_data["ip"]
except requests.exceptions.RequestException as x:
print(type(x), x)
result = '0.0.0.0'
try:
response = requests.get("https://ident.me", timeout=timeout)
response.raise_for_status() # Raises a HTTPError if the response was unsuccessful
result = response.text
except requests.exceptions.RequestException as x:
print(type(x), x)
result = "0.0.0.0"
return result

class findora_env:
Expand All @@ -23,7 +31,7 @@ class findora_env:
findora_root_testnet = f"{findora_root}/testnet"
toolbox_location = os.path.join(user_home_dir, "findora-toolbox")
web_location = os.path.join(user_home_dir, "findora-toolbox-web")
our_external_ip = getUrl()
our_external_ip = get_url()
findora_menu = os.path.join(toolbox_location, "src", "messages", "framenu.txt")
container_name = "findorad"
migrate_dir = os.path.join(user_home_dir, "migrate")
Expand Down

0 comments on commit f7a2222

Please sign in to comment.