convert acquire-wan-address to writeFennel

this means we can get rid of the inelegant environent variable
check at the bottom of the file
This commit is contained in:
Daniel Barlow
2023-09-12 17:51:00 +01:00
parent 343d3b6508
commit 0a737c62cd
2 changed files with 9 additions and 11 deletions

View File

@@ -30,8 +30,9 @@
(.. "ip address del " p.address "/" p.len " dev " wan-device)))
new-addresses))
(fn run [state-directory wan-device]
(let [dir (svc.open state-directory)]
(fn run []
(let [[state-directory wan-device] arg
dir (svc.open state-directory)]
(var addresses [])
(while true
(while (not (dir:ready?)) (dir:wait))
@@ -40,8 +41,4 @@
(update-addresses wan-device addresses (dir:output "address"))))
(dir:wait))))
(if (os.getenv "RUN_TESTS")
{ : update-addresses : changes : run }
(let [[state-directory wan-device] arg]
(run state-directory wan-device)))
{ : update-addresses : changes : run }