mirror of
https://github.com/gravitl/netmaker.git
synced 2024-09-20 07:16:06 +08:00
Remove config.Server.Debug
no longer required with move to logger.Log and it's verbosity capabilities
This commit is contained in:
parent
5d3274e48d
commit
501108b53d
|
@ -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"`
|
||||
|
|
1
dev.yaml
1
dev.yaml
|
@ -33,7 +33,6 @@ server:
|
|||
displaykeys: ""
|
||||
azuretenant: ""
|
||||
rce: "off"
|
||||
debug: ""
|
||||
telemetry: ""
|
||||
manageiptables: "off"
|
||||
portforwardservices: ""
|
||||
|
|
|
@ -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()))
|
||||
}
|
||||
|
|
6
mq/mq.go
6
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")
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue