Only run configure if anything changed

dev
Ruakij 2 years ago
parent e980f520e2
commit 4fd103f722

@ -123,10 +123,14 @@ func main() {
} }
} }
if(len(wgConfig.Peers) == 0){
logger.Info.Println("No changes, skipping")
} else {
err = client.ConfigureDevice(iface, wgConfig) err = client.ConfigureDevice(iface, wgConfig)
if(err != nil){ if(err != nil){
logger.Error.Fatalf("Error configuring wg-device '%s': %s", iface, err) logger.Error.Fatalf("Error configuring wg-device '%s': %s", iface, err)
} }
}
// Sleep for 300 seconds before running the loop again // Sleep for 300 seconds before running the loop again
time.Sleep(time.Second * 300) time.Sleep(time.Second * 300)

Loading…
Cancel
Save