1
0
mirror of https://github.com/juanfont/headscale.git synced 2024-12-20 19:09:07 +01:00

Add error if peer api is empty

This commit is contained in:
Kristoffer Dalby 2021-10-04 14:14:12 +01:00
parent 1bddf1147b
commit 7793012409
No known key found for this signature in database
GPG Key ID: 09F62DC067465735

View File

@ -7,6 +7,7 @@ import (
"bytes" "bytes"
"context" "context"
"encoding/json" "encoding/json"
"errors"
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"log" "log"
@ -692,6 +693,9 @@ func getAPIURLs(tailscales map[string]dockertest.Resource) (map[netaddr.IP]strin
n := ft.Node n := ft.Node
for _, a := range n.Addresses { // just add all the addresses for _, a := range n.Addresses { // just add all the addresses
if _, ok := fts[a.IP()]; !ok { if _, ok := fts[a.IP()]; !ok {
if ft.PeerAPIURL == "" {
return nil, errors.New("api url is empty")
}
fts[a.IP()] = ft.PeerAPIURL fts[a.IP()] = ft.PeerAPIURL
} }
} }