Only run configure if anything changed

This commit is contained in:
Ruakij 2023-03-31 20:01:13 +02:00
parent e980f520e2
commit 4fd103f722

View File

@ -123,9 +123,13 @@ func main() {
} }
} }
err = client.ConfigureDevice(iface, wgConfig) if(len(wgConfig.Peers) == 0){
if(err != nil){ logger.Info.Println("No changes, skipping")
logger.Error.Fatalf("Error configuring wg-device '%s': %s", iface, err) } else {
err = client.ConfigureDevice(iface, wgConfig)
if(err != nil){
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