mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2024-12-23 07:34:35 -06:00
Fixed the default Public IP range in AWS deployment.
This commit is contained in:
parent
0f5d4cd7b7
commit
99c6b171e4
@ -10,6 +10,7 @@
|
||||
import random
|
||||
import string
|
||||
import urllib3
|
||||
import ipaddress
|
||||
|
||||
|
||||
def get_my_ip():
|
||||
@ -23,6 +24,15 @@ def get_my_ip():
|
||||
except Exception:
|
||||
external_ip = '127.0.0.1'
|
||||
|
||||
if type(external_ip) == bytes:
|
||||
external_ip = external_ip.decode('utf-8')
|
||||
|
||||
ip = ipaddress.ip_address(external_ip)
|
||||
if isinstance(ip, ipaddress.IPv4Address):
|
||||
return '{}/{}'.format(external_ip, 32)
|
||||
elif isinstance(ip, ipaddress.IPv6Address):
|
||||
return '{}/{}'.format(external_ip, 128)
|
||||
|
||||
return '{}/{}'.format(external_ip, 32)
|
||||
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
# ##########################################################################
|
||||
|
||||
import urllib3
|
||||
import ipaddress
|
||||
|
||||
|
||||
def get_my_ip():
|
||||
@ -21,4 +22,13 @@ def get_my_ip():
|
||||
except Exception:
|
||||
external_ip = '127.0.0.1'
|
||||
|
||||
if type(external_ip) == bytes:
|
||||
external_ip = external_ip.decode('utf-8')
|
||||
|
||||
ip = ipaddress.ip_address(external_ip)
|
||||
if isinstance(ip, ipaddress.IPv4Address):
|
||||
return '{}/{}'.format(external_ip, 32)
|
||||
elif isinstance(ip, ipaddress.IPv6Address):
|
||||
return '{}/{}'.format(external_ip, 128)
|
||||
|
||||
return '{}/{}'.format(external_ip, 32)
|
||||
|
Loading…
Reference in New Issue
Block a user