diff --git a/config/config.go b/config/config.go index 7ca87fe7..344729d1 100644 --- a/config/config.go +++ b/config/config.go @@ -61,7 +61,6 @@ type ServerConfig struct { DisplayKeys string `yaml:"displaykeys"` AzureTenant string `yaml:"azuretenant"` RCE string `yaml:"rce"` - Debug bool `yaml:"debug"` Telemetry string `yaml:"telemetry"` ManageIPTables string `yaml:"manageiptables"` PortForwardServices string `yaml:"portforwardservices"` diff --git a/dev.yaml b/dev.yaml index 7970ad6e..c2af170e 100644 --- a/dev.yaml +++ b/dev.yaml @@ -33,7 +33,6 @@ server: displaykeys: "" azuretenant: "" rce: "off" - debug: "" telemetry: "" manageiptables: "off" portforwardservices: "" diff --git a/mq/handlers.go b/mq/handlers.go index 27d57fd0..5ef6e023 100644 --- a/mq/handlers.go +++ b/mq/handlers.go @@ -11,7 +11,7 @@ import ( "github.com/gravitl/netmaker/netclient/ncutils" ) -// DefaultHandler default message queue handler - only called when GetDebug == true +// DefaultHandler default message queue handler -- NOT USED func DefaultHandler(client mqtt.Client, msg mqtt.Message) { logger.Log(0, "MQTT Message: Topic: ", string(msg.Topic()), " Message: ", string(msg.Payload())) } diff --git a/mq/mq.go b/mq/mq.go index 9cbdb2ec..07f4b1ba 100644 --- a/mq/mq.go +++ b/mq/mq.go @@ -31,12 +31,6 @@ func SetupMQTT(publish bool) mqtt.Client { opts.SetWriteTimeout(time.Minute) opts.SetOnConnectHandler(func(client mqtt.Client) { if !publish { - if servercfg.GetDebug() { - if token := client.Subscribe("#", 2, mqtt.MessageHandler(DefaultHandler)); token.Wait() && token.Error() != nil { - client.Disconnect(240) - logger.Log(0, "default subscription failed") - } - } if token := client.Subscribe("ping/#", 2, mqtt.MessageHandler(Ping)); token.Wait() && token.Error() != nil { client.Disconnect(240) logger.Log(0, "ping subscription failed") diff --git a/netclient/command/commands.go b/netclient/command/commands.go index bda80cce..37fad591 100644 --- a/netclient/command/commands.go +++ b/netclient/command/commands.go @@ -18,7 +18,7 @@ func Join(cfg *config.ClientConfig, privateKey string) error { var err error //join network err = functions.JoinNetwork(cfg, privateKey) - if err != nil && !cfg.DebugOn { + if err != nil { if !strings.Contains(err.Error(), "ALREADY_INSTALLED") { logger.Log(1, "error installing: ", err.Error()) err = functions.LeaveNetwork(cfg.Network, true) diff --git a/netclient/config/config.go b/netclient/config/config.go index 4bba82e9..13a1fc1a 100644 --- a/netclient/config/config.go +++ b/netclient/config/config.go @@ -28,7 +28,6 @@ type ClientConfig struct { Network string `yaml:"network"` Daemon string `yaml:"daemon"` OperatingSystem string `yaml:"operatingsystem"` - DebugOn bool `yaml:"debugon"` } // ServerConfig - struct for dealing with the server information for a netclient diff --git a/netclient/functions/daemon.go b/netclient/functions/daemon.go index d4792027..eeabc635 100644 --- a/netclient/functions/daemon.go +++ b/netclient/functions/daemon.go @@ -114,13 +114,6 @@ func UpdateKeys(nodeCfg *config.ClientConfig, client mqtt.Client) error { // sets MQ client subscriptions for a specific node config // should be called for each node belonging to a given server func setSubscriptions(client mqtt.Client, nodeCfg *config.ClientConfig) { - if nodeCfg.DebugOn { - if token := client.Subscribe("#", 0, nil); token.Wait() && token.Error() != nil { - logger.Log(0, token.Error().Error()) - return - } - logger.Log(0, "subscribed to all topics for debugging purposes") - } if token := client.Subscribe(fmt.Sprintf("update/%s/%s", nodeCfg.Node.Network, nodeCfg.Node.ID), 0, mqtt.MessageHandler(NodeUpdate)); token.Wait() && token.Error() != nil { logger.Log(0, token.Error().Error()) return diff --git a/servercfg/serverconf.go b/servercfg/serverconf.go index ca8ea73b..f9bdfe48 100644 --- a/servercfg/serverconf.go +++ b/servercfg/serverconf.go @@ -78,7 +78,6 @@ func GetServerConfig() config.ServerConfig { } else { cfg.RCE = "off" } - cfg.Debug = GetDebug() cfg.Telemetry = Telemetry() cfg.ManageIPTables = ManageIPTables() services := strings.Join(GetPortForwardServiceList(), ",") @@ -546,8 +545,3 @@ func GetAzureTenant() string { func GetRce() bool { return os.Getenv("RCE") == "on" || config.Config.Server.RCE == "on" } - -// GetDebug -- checks if debugging is enabled, off by default -func GetDebug() bool { - return os.Getenv("DEBUG") == "on" || config.Config.Server.Debug == true -}