A eureka client written in python. Support registering your python component to Eureka Server, as well as calling remote services by pulling the the Eureka registry.
MIT License
187
stars
44
forks
source link
New optional parameter instance_ip_network to force autodetect correct network #48
I had the situation, that my first non loopback device was a openvpn adapter. In this case, the auto guess function selects the wrong IP address. Maybe it is useful, to have the possibility to define a correct network IP range for auto detection. For example, if all microservices receives the configuration via Spring Cloud Config, the correct (docker) network IP range can be via this parameter.
Of cause, it is already possible, to to this like you documented it in the README.md:
import py_eureka_client.netint_utils as netint_utils
ip, host = netint_utils.get_ip_and_host("192.168.10.0/24")
# you can get the ip only
ip = netint_utils.get_first_non_loopback_ip("192.168.10.0/24")
host = "my-py-component.mydomian.com"
eureka_client.init(eureka_server="your-eureka-server-peer1,your-eureka-server-peer2",
eureka_protocol="https",
eureka_basic_auth_user="keijack",
eureka_basic_auth_password="kjauthpass",
eureka_context="/eureka/v2",
app_name="python_module_1",
instance_ip=ip,
instance_host=host,
instance_port=9090)
I had the situation, that my first non loopback device was a openvpn adapter. In this case, the auto guess function selects the wrong IP address. Maybe it is useful, to have the possibility to define a correct network IP range for auto detection. For example, if all microservices receives the configuration via Spring Cloud Config, the correct (docker) network IP range can be via this parameter.
Of cause, it is already possible, to to this like you documented it in the README.md:
So this change is just a comfort improvement :)