Development
This commit is contained in:
parent
f320132e61
commit
9f71fe31a6
1 changed files with 7 additions and 5 deletions
|
|
@ -418,13 +418,15 @@ def setup_caddy(domain, email):
|
|||
|
||||
|
||||
def _lan_ip():
|
||||
"""Best-effort local LAN IP for the informational message."""
|
||||
"""Read the LAN IP from routlin's networkd config files."""
|
||||
import glob
|
||||
try:
|
||||
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
||||
s.connect(("8.8.8.8", 80))
|
||||
return s.getsockname()[0]
|
||||
for path in sorted(glob.glob("/etc/systemd/network/10-routlin-*.network")):
|
||||
for m in re.finditer(r'^Address=(\d+\.\d+\.\d+\.\d+)/', Path(path).read_text(), re.MULTILINE):
|
||||
return m.group(1)
|
||||
except Exception:
|
||||
return "127.0.0.1"
|
||||
pass
|
||||
return "this server"
|
||||
|
||||
|
||||
# ===================================================================
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue