1
0
mirror of https://github.com/juanfont/headscale.git synced 2025-05-27 01:18:48 +02:00

hsic: only set db policy if exist

Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
This commit is contained in:
Kristoffer Dalby 2025-03-31 08:29:41 +02:00
parent 52d65d77b8
commit e02987cfef
No known key found for this signature in database
2 changed files with 3 additions and 2 deletions

View File

@ -448,7 +448,7 @@ func New(
// Load the database from policy file on repeat until it succeeds,
// this is done as the container sleeps before starting headscale.
if hsic.policyMode == types.PolicyModeDB {
if hsic.aclPolicy != nil && hsic.policyMode == types.PolicyModeDB {
err := pool.Retry(hsic.reloadDatabasePolicy)
if err != nil {
return nil, fmt.Errorf("loading database policy on startup: %w", err)

View File

@ -1401,7 +1401,7 @@ func TestAutoApproveMultiNetwork(t *testing.T) {
},
},
TagOwners: map[string][]string{
"tag:approve": {"user1"},
"tag:approve": {"user1@"},
},
AutoApprovers: policyv1.AutoApprovers{
Routes: map[string][]string{
@ -1598,6 +1598,7 @@ func TestAutoApproveMultiNetwork(t *testing.T) {
peerStatus := status.Peer[peerKey]
if peerStatus.ID == "1" {
require.NotNil(t, peerStatus.PrimaryRoutes)
assert.Contains(t, peerStatus.PrimaryRoutes.AsSlice(), *route)
requirePeerSubnetRoutes(t, peerStatus, []netip.Prefix{*route})
} else {