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():
|
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:
|
try:
|
||||||
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
for path in sorted(glob.glob("/etc/systemd/network/10-routlin-*.network")):
|
||||||
s.connect(("8.8.8.8", 80))
|
for m in re.finditer(r'^Address=(\d+\.\d+\.\d+\.\d+)/', Path(path).read_text(), re.MULTILINE):
|
||||||
return s.getsockname()[0]
|
return m.group(1)
|
||||||
except Exception:
|
except Exception:
|
||||||
return "127.0.0.1"
|
pass
|
||||||
|
return "this server"
|
||||||
|
|
||||||
|
|
||||||
# ===================================================================
|
# ===================================================================
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue