Add multi-server data model + legacy DB migration (step 0)
Adds Server.ID/Name, ServerInterface.Name, Client.ServerID, and a new ServerSetting type as additive fields so existing single-server code paths keep working unchanged. jsondb.Init() now detects a pre-existing single-server db/server/ layout and mirrors it into new servers/, server_settings/, server_hashes/ collections plus backfills ServerID on existing clients, without touching/removing the legacy files yet.
This commit is contained in:
@@ -6,6 +6,8 @@ import (
|
||||
|
||||
// Server model
|
||||
type Server struct {
|
||||
ID string `json:"id,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
KeyPair *ServerKeypair
|
||||
Interface *ServerInterface
|
||||
}
|
||||
@@ -19,6 +21,7 @@ type ServerKeypair struct {
|
||||
|
||||
// ServerInterface model
|
||||
type ServerInterface struct {
|
||||
Name string `json:"name,omitempty"` // OS interface name, e.g. wg0
|
||||
Addresses []string `json:"addresses"`
|
||||
ListenPort int `json:"listen_port,string"` // ,string to get listen_port string input as int
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
|
||||
Reference in New Issue
Block a user