I found a few bugs when updating the running state, which resulted in the autostart feature didn't work as it was supposed to.
For some reason, the command 'wg show ' doesn't return an error in the subprocess but it returns an output when the main.py first starts. That's the reason why the interfaces never started on boot, even if the last_state (is_running attribute) was set to True.
The code always though it already was running, since the _script.wireguard.isrunning(s) function returned an incorrect state (True, in this case).
While I was looking into this, I also found that the is_running state never was set top False once an interface was started. And it turned out to be some "copypasta" error.
So, after fixing these two issues, the state is now correct. Each interface will now keep its state, even if the docker container (or the application) is restarted.
I also fixed a few things in the README.md as well :)
Fix #13
I found a few bugs when updating the running state, which resulted in the autostart feature didn't work as it was supposed to.
For some reason, the command 'wg show' doesn't return an error in the subprocess but it returns an output when the main.py first starts. That's the reason why the interfaces never started on boot, even if the last_state (is_running attribute) was set to True.
The code always though it already was running, since the _script.wireguard.isrunning(s) function returned an incorrect state (True, in this case).
While I was looking into this, I also found that the is_running state never was set top False once an interface was started. And it turned out to be some "copypasta" error.
So, after fixing these two issues, the state is now correct. Each interface will now keep its state, even if the docker container (or the application) is restarted.
I also fixed a few things in the README.md as well :)