fix ip migration
Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
This commit is contained in:
parent
d4af0c386c
commit
40953727cf
|
@ -356,7 +356,7 @@ func NewHeadscaleDatabase(
|
||||||
addrs := strings.Split(node.Addresses, ",")
|
addrs := strings.Split(node.Addresses, ",")
|
||||||
|
|
||||||
if len(addrs) == 0 {
|
if len(addrs) == 0 {
|
||||||
fmt.Errorf("no addresses found for node(%d)", node.ID)
|
return fmt.Errorf("no addresses found for node(%d)", node.ID)
|
||||||
}
|
}
|
||||||
|
|
||||||
var v4 *netip.Addr
|
var v4 *netip.Addr
|
||||||
|
@ -377,7 +377,12 @@ func NewHeadscaleDatabase(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
err = tx.Save(&types.Node{ID: types.NodeID(node.ID), IPv4: v4, IPv6: v6}).Error
|
err = tx.Model(&types.Node{}).Where("id = ?", node.ID).Update("ipv4", v4.String()).Error
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("saving ip addresses to new columns: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
err = tx.Model(&types.Node{}).Where("id = ?", node.ID).Update("ipv6", v6.String()).Error
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("saving ip addresses to new columns: %w", err)
|
return fmt.Errorf("saving ip addresses to new columns: %w", err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -238,7 +238,7 @@ func LoadConfig(path string, isFile bool) error {
|
||||||
viper.SetDefault("tuning.batch_change_delay", "800ms")
|
viper.SetDefault("tuning.batch_change_delay", "800ms")
|
||||||
viper.SetDefault("tuning.node_mapsession_buffered_chan_size", 30)
|
viper.SetDefault("tuning.node_mapsession_buffered_chan_size", 30)
|
||||||
|
|
||||||
viper.SetDefault("prefixes.allocation", IPAllocationStrategySequential)
|
viper.SetDefault("prefixes.allocation", string(IPAllocationStrategySequential))
|
||||||
|
|
||||||
if IsCLIConfigured() {
|
if IsCLIConfigured() {
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in New Issue