mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-01-11 00:22:34 -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 random
|
||||||
import string
|
import string
|
||||||
import urllib3
|
import urllib3
|
||||||
|
import ipaddress
|
||||||
|
|
||||||
|
|
||||||
def get_my_ip():
|
def get_my_ip():
|
||||||
@ -23,6 +24,15 @@ def get_my_ip():
|
|||||||
except Exception:
|
except Exception:
|
||||||
external_ip = '127.0.0.1'
|
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)
|
return '{}/{}'.format(external_ip, 32)
|
||||||
|
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
# ##########################################################################
|
# ##########################################################################
|
||||||
|
|
||||||
import urllib3
|
import urllib3
|
||||||
|
import ipaddress
|
||||||
|
|
||||||
|
|
||||||
def get_my_ip():
|
def get_my_ip():
|
||||||
@ -21,4 +22,13 @@ def get_my_ip():
|
|||||||
except Exception:
|
except Exception:
|
||||||
external_ip = '127.0.0.1'
|
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)
|
return '{}/{}'.format(external_ip, 32)
|
||||||
|
Loading…
Reference in New Issue
Block a user