1
0
Fork 0
mirror of https://github.com/postmannen/ctrl.git synced 2024-12-14 12:37:31 +00:00

added flag for debugLogging

This commit is contained in:
postmannen 2022-02-18 06:24:27 +01:00
parent c94213fe36
commit f32aa2d89b

View file

@ -79,6 +79,9 @@ type Configuration struct {
EnableSignatureCheck bool
// IsCentralAuth
IsCentralAuth bool
// EnableDebug will also enable printing all the messages received in the errorKernel
// to STDERR.
EnableDebug bool
// Make the current node send hello messages to central at given interval in seconds
StartPubREQHello int
@ -151,6 +154,7 @@ type ConfigurationFromFile struct {
EnableTUI *bool
EnableSignatureCheck *bool
IsCentralAuth *bool
EnableDebug *bool
StartPubREQHello *int
StartSubREQErrorLog *bool
@ -210,6 +214,7 @@ func newConfigurationDefaults() Configuration {
EnableTUI: false,
EnableSignatureCheck: false,
IsCentralAuth: false,
EnableDebug: false,
StartPubREQHello: 30,
StartSubREQErrorLog: false,
@ -392,6 +397,11 @@ func checkConfigValues(cf ConfigurationFromFile) Configuration {
} else {
conf.IsCentralAuth = *cf.IsCentralAuth
}
if cf.EnableDebug == nil {
conf.EnableDebug = cd.EnableDebug
} else {
conf.EnableDebug = *cf.EnableDebug
}
// --- Start pub/sub
@ -538,6 +548,7 @@ func (c *Configuration) CheckFlags() error {
flag.BoolVar(&c.EnableTUI, "enableTUI", fc.EnableTUI, "true/false for enabling the Terminal User Interface")
flag.BoolVar(&c.EnableSignatureCheck, "enableSignatureCheck", fc.EnableSignatureCheck, "true/false *TESTING* enable signature checking.")
flag.BoolVar(&c.IsCentralAuth, "isCentralAuth", fc.IsCentralAuth, "true/false, *TESTING* is this the central auth server")
flag.BoolVar(&c.EnableDebug, "enableDebug", fc.EnableDebug, "true/false, will enable debug logging so all messages sent to the errorKernel will also be printed to STDERR")
flag.IntVar(&c.StartPubREQHello, "startPubREQHello", fc.StartPubREQHello, "Make the current node send hello messages to central at given interval in seconds")