Browse Source

Change to single variable in ClientConfig (no nested GlobalSettings).

cameronts 3 years ago
parent
commit
05283eff14
3 changed files with 4 additions and 9 deletions
  1. 2 7
      netclient/config/config.go
  2. 1 1
      netclient/functions/join.go
  3. 1 1
      netclient/functions/mqpublish.go

+ 2 - 7
netclient/config/config.go

@@ -26,16 +26,11 @@ type ClientConfig struct {
 	Server          models.ServerConfig `yaml:"server"`
 	Server          models.ServerConfig `yaml:"server"`
 	Node            models.Node         `yaml:"node"`
 	Node            models.Node         `yaml:"node"`
 	NetworkSettings models.Network      `yaml:"networksettings"`
 	NetworkSettings models.Network      `yaml:"networksettings"`
-	GlobalSettings  GlobalSettings      `yaml:"globalSettings"`
 	Network         string              `yaml:"network"`
 	Network         string              `yaml:"network"`
 	Daemon          string              `yaml:"daemon"`
 	Daemon          string              `yaml:"daemon"`
 	OperatingSystem string              `yaml:"operatingsystem"`
 	OperatingSystem string              `yaml:"operatingsystem"`
 	AccessKey       string              `yaml:"accesskey"`
 	AccessKey       string              `yaml:"accesskey"`
-}
-
-// GlobalSettings - settings that apply for the netclient across networks
-type GlobalSettings struct {
-	PublicIPService string `yaml:"publicIPService"`
+	PublicIPService string              `yaml:"publicipservice"`
 }
 }
 
 
 // RegisterRequest - struct for registation with netmaker server
 // RegisterRequest - struct for registation with netmaker server
@@ -237,7 +232,7 @@ func GetCLIConfig(c *cli.Context) (ClientConfig, string, error) {
 		cfg.Server.CoreDNSAddr = c.String("corednsaddr")
 		cfg.Server.CoreDNSAddr = c.String("corednsaddr")
 		cfg.Server.API = c.String("apiserver")
 		cfg.Server.API = c.String("apiserver")
 	}
 	}
-	cfg.GlobalSettings.PublicIPService = c.String("publicipservice")
+	cfg.PublicIPService = c.String("publicipservice")
 	cfg.Node.Name = c.String("name")
 	cfg.Node.Name = c.String("name")
 	cfg.Node.Interface = c.String("interface")
 	cfg.Node.Interface = c.String("interface")
 	cfg.Node.Password = c.String("password")
 	cfg.Node.Password = c.String("password")

+ 1 - 1
netclient/functions/join.go

@@ -85,7 +85,7 @@ func JoinNetwork(cfg *config.ClientConfig, privateKey string) error {
 		if cfg.Node.IsLocal == "yes" && cfg.Node.LocalAddress != "" {
 		if cfg.Node.IsLocal == "yes" && cfg.Node.LocalAddress != "" {
 			cfg.Node.Endpoint = cfg.Node.LocalAddress
 			cfg.Node.Endpoint = cfg.Node.LocalAddress
 		} else {
 		} else {
-			cfg.Node.Endpoint, err = ncutils.GetPublicIP(cfg.GlobalSettings.PublicIPService)
+			cfg.Node.Endpoint, err = ncutils.GetPublicIP(cfg.PublicIPService)
 		}
 		}
 		if err != nil || cfg.Node.Endpoint == "" {
 		if err != nil || cfg.Node.Endpoint == "" {
 			logger.Log(0, "network:", cfg.Network, "error setting cfg.Node.Endpoint.")
 			logger.Log(0, "network:", cfg.Network, "error setting cfg.Node.Endpoint.")

+ 1 - 1
netclient/functions/mqpublish.go

@@ -44,7 +44,7 @@ func checkin() {
 		nodeCfg.Network = network
 		nodeCfg.Network = network
 		nodeCfg.ReadConfig()
 		nodeCfg.ReadConfig()
 		if nodeCfg.Node.IsStatic != "yes" {
 		if nodeCfg.Node.IsStatic != "yes" {
-			extIP, err := ncutils.GetPublicIP(nodeCfg.GlobalSettings.PublicIPService)
+			extIP, err := ncutils.GetPublicIP(nodeCfg.PublicIPService)
 			if err != nil {
 			if err != nil {
 				logger.Log(1, "error encountered checking public ip addresses: ", err.Error())
 				logger.Log(1, "error encountered checking public ip addresses: ", err.Error())
 			}
 			}