elviejokike / flask-eureka

Flask Eureka Integration
MIT License
25 stars 18 forks source link

Failing to get port in Windows #12

Open alexadastra opened 3 years ago

alexadastra commented 3 years ago

While trying to register flask service, Eureka client tries to get ipv4 with this code: def ipv4(self): if self.system == 'Darwin': ipv4 = getoutput("ifconfig " + self.iface + " | grep 'inet ' | awk '{ print $2 }'") else: ipv4 = getoutput("ifconfig " + self.iface + " | grep 'inet addr' | awk '{ print $2 }'") ipv4 = ipv4.split(':')[1] Here command ifconfig is called in terminal. However, there's no such command in Windows terminal, so getoutput function result is '"ifconfig" ­Ґ пў«пҐвбп ў­гв७­Ґ© Ё«Ё ў­Ґи­Ґ© Є®¬ ­¤®©, ЁбЇ®«­пҐ¬®© Їа®Ја ¬¬®© Ё«Ё Ї ЄҐв­л¬ д ©«®¬.'. By decoding this, I get '"ifconfig" не является внутренней или внешней командой, исполняемой программой или пакетным файлом.', which is the message that command was not found in Russian. Unsuprisingly, the whole library won't work on Windows.

shouldsee commented 1 year ago

using ifconfig is not a portable api to get machine port