Restore foreign keys and add constraints (#1562)
* fix #1482, restore foregin keys, add constraints * #1562, fix tests, fix formatting * #1562: fix tests * #1562: fix local run of test_integration
This commit is contained in:
parent
2bac80cfbf
commit
7fd2485000
15 changed files with 149 additions and 61 deletions
|
@ -314,7 +314,11 @@ func (h *Headscale) handleAuthKey(
|
|||
Msg("node was already registered before, refreshing with new auth key")
|
||||
|
||||
node.NodeKey = nodeKey
|
||||
node.AuthKeyID = uint(pak.ID)
|
||||
pakID := uint(pak.ID)
|
||||
if pakID != 0 {
|
||||
node.AuthKeyID = &pakID
|
||||
}
|
||||
|
||||
node.Expiry = ®isterRequest.Expiry
|
||||
node.User = pak.User
|
||||
node.UserID = pak.UserID
|
||||
|
@ -373,7 +377,6 @@ func (h *Headscale) handleAuthKey(
|
|||
Expiry: ®isterRequest.Expiry,
|
||||
NodeKey: nodeKey,
|
||||
LastSeen: &now,
|
||||
AuthKeyID: uint(pak.ID),
|
||||
ForcedTags: pak.Proto().GetAclTags(),
|
||||
}
|
||||
|
||||
|
@ -389,6 +392,10 @@ func (h *Headscale) handleAuthKey(
|
|||
return
|
||||
}
|
||||
|
||||
pakID := uint(pak.ID)
|
||||
if pakID != 0 {
|
||||
nodeToRegister.AuthKeyID = &pakID
|
||||
}
|
||||
node, err = h.db.RegisterNode(
|
||||
nodeToRegister,
|
||||
ipv4, ipv6,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue