Skip to content

Commit e37b09d

Browse files
committed
trim newline on privatekey
1 parent 948ab9b commit e37b09d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

cmd/gateway-agent/main.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"io/ioutil"
77
"net/http"
88
"path/filepath"
9+
"strings"
910
"time"
1011

1112
"github.com/nais/device/apiserver/api"
@@ -92,7 +93,7 @@ func configureWireguard(peers []api.Peer, privateKey string) error {
9293

9394
func generateWGConfig(peers []api.Peer, privateKey string) []byte {
9495
wgConfig := "[Interface]\n"
95-
wgConfig += fmt.Sprintf("PrivateKey = %s\n", privateKey)
96+
wgConfig += fmt.Sprintf("PrivateKey = %s\n", strings.Trim(privateKey, "\n"))
9697
wgConfig += "ListenPort = 51820\n"
9798
for _, peer := range peers {
9899
wgConfig += "[Peer]\n"

0 commit comments

Comments
 (0)