feat(config): read Wireguard config from secret

- defaults to `/run/secrets/wg0.conf`
- can be changed with variable `WIREGUARD_CONF_SECRETFILE`
This commit is contained in:
Quentin McGaw
2024-03-21 08:17:21 +00:00
parent 9cb4c74493
commit 6096b7ad4b
4 changed files with 37 additions and 5 deletions

View File

@@ -1,6 +1,7 @@
package secrets
import (
"fmt"
"os"
"github.com/qdm12/gluetun/internal/configuration/settings"
@@ -36,5 +37,10 @@ func (s *Source) Read() (settings settings.Settings, err error) {
return settings, err
}
settings.VPN.Wireguard, err = s.readWireguard()
if err != nil {
return settings, fmt.Errorf("reading Wireguard: %w", err)
}
return settings, nil
}