Support routes.
This commit is contained in:
@@ -88,10 +88,6 @@ type GlobalConfig struct {
|
||||
Central struct {
|
||||
Domain string `yaml:"domain,omitempty" json:"domain,omitempty"` // e.g. "central.payne.io"
|
||||
} `yaml:"central,omitempty" json:"central,omitempty"`
|
||||
Router struct {
|
||||
IP string `yaml:"ip,omitempty" json:"ip,omitempty"`
|
||||
DynamicDns string `yaml:"dynamicDns,omitempty" json:"dynamicDns,omitempty"`
|
||||
} `yaml:"router,omitempty" json:"router,omitempty"`
|
||||
Dnsmasq struct {
|
||||
IP string `yaml:"ip,omitempty" json:"ip,omitempty"`
|
||||
Interface string `yaml:"interface,omitempty" json:"interface,omitempty"`
|
||||
@@ -121,8 +117,8 @@ type GlobalConfig struct {
|
||||
} `yaml:"cloud,omitempty" json:"cloud,omitempty"`
|
||||
}
|
||||
|
||||
// LoadGlobalConfig loads configuration from the specified path
|
||||
func LoadGlobalConfig(configPath string) (*GlobalConfig, error) {
|
||||
// LoadState loads state from the specified path
|
||||
func LoadState(configPath string) (*GlobalConfig, error) {
|
||||
data, err := os.ReadFile(configPath)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("reading config file %s: %w", configPath, err)
|
||||
@@ -136,8 +132,8 @@ func LoadGlobalConfig(configPath string) (*GlobalConfig, error) {
|
||||
return config, nil
|
||||
}
|
||||
|
||||
// SaveGlobalConfig saves the configuration to the specified path
|
||||
func SaveGlobalConfig(config *GlobalConfig, configPath string) error {
|
||||
// SaveState saves the state to the specified path
|
||||
func SaveState(config *GlobalConfig, configPath string) error {
|
||||
// Ensure the directory exists
|
||||
if err := os.MkdirAll(filepath.Dir(configPath), 0755); err != nil {
|
||||
return fmt.Errorf("creating config directory: %w", err)
|
||||
@@ -158,7 +154,7 @@ func (c *GlobalConfig) IsEmpty() bool {
|
||||
}
|
||||
|
||||
// Check if essential fields are empty
|
||||
return c.Cloud.Router.IP == "" && c.Operator.Email == ""
|
||||
return c.Cloud.Central.Domain == "" && c.Operator.Email == ""
|
||||
}
|
||||
|
||||
type NodeConfig struct {
|
||||
|
||||
Reference in New Issue
Block a user