mirror of
https://github.com/postmannen/ctrl.git
synced 2025-01-05 20:09:16 +00:00
replaced keys/acl startREQ flags with enable flag
This commit is contained in:
parent
592425d53c
commit
368ac6e661
2 changed files with 52 additions and 72 deletions
|
@ -93,15 +93,11 @@ type Configuration struct {
|
||||||
|
|
||||||
// Make the current node send hello messages to central at given interval in seconds
|
// Make the current node send hello messages to central at given interval in seconds
|
||||||
StartPubREQHello int
|
StartPubREQHello int
|
||||||
// Publisher for asking central for public keys
|
// Enable the updates of public keys
|
||||||
StartPubREQKeysRequestUpdate bool
|
EnableKeyUpdates bool
|
||||||
// Subscriber for receiving updates of public keys from central
|
|
||||||
StartSubREQKeysDeliverUpdate bool
|
|
||||||
|
|
||||||
// Publisher for asking central for public acl updates
|
// Enable the updates of acl's
|
||||||
StartPubREQAclRequestUpdate bool
|
EnableAclUpdates bool
|
||||||
// Subscriber for receiving updates of acl's from central
|
|
||||||
StartSubREQAclDeliverUpdate bool
|
|
||||||
|
|
||||||
// Start the central error logger.
|
// Start the central error logger.
|
||||||
StartSubREQErrorLog bool
|
StartSubREQErrorLog bool
|
||||||
|
@ -178,27 +174,25 @@ type ConfigurationFromFile struct {
|
||||||
IsCentralAuth *bool
|
IsCentralAuth *bool
|
||||||
EnableDebug *bool
|
EnableDebug *bool
|
||||||
|
|
||||||
StartPubREQHello *int
|
StartPubREQHello *int
|
||||||
StartPubREQKeysRequestUpdate *bool
|
EnableKeyUpdates *bool
|
||||||
StartSubREQKeysDeliverUpdate *bool
|
EnableAclUpdates *bool
|
||||||
StartPubREQAclRequestUpdate *bool
|
StartSubREQErrorLog *bool
|
||||||
StartSubREQAclDeliverUpdate *bool
|
StartSubREQHello *bool
|
||||||
StartSubREQErrorLog *bool
|
StartSubREQToFileAppend *bool
|
||||||
StartSubREQHello *bool
|
StartSubREQToFile *bool
|
||||||
StartSubREQToFileAppend *bool
|
StartSubREQToFileNACK *bool
|
||||||
StartSubREQToFile *bool
|
StartSubREQCopyFileFrom *bool
|
||||||
StartSubREQToFileNACK *bool
|
StartSubREQCopyFileTo *bool
|
||||||
StartSubREQCopyFileFrom *bool
|
StartSubREQPing *bool
|
||||||
StartSubREQCopyFileTo *bool
|
StartSubREQPong *bool
|
||||||
StartSubREQPing *bool
|
StartSubREQCliCommand *bool
|
||||||
StartSubREQPong *bool
|
StartSubREQToConsole *bool
|
||||||
StartSubREQCliCommand *bool
|
StartSubREQHttpGet *bool
|
||||||
StartSubREQToConsole *bool
|
StartSubREQHttpGetScheduled *bool
|
||||||
StartSubREQHttpGet *bool
|
StartSubREQTailFile *bool
|
||||||
StartSubREQHttpGetScheduled *bool
|
StartSubREQCliCommandCont *bool
|
||||||
StartSubREQTailFile *bool
|
StartSubREQRelay *bool
|
||||||
StartSubREQCliCommandCont *bool
|
|
||||||
StartSubREQRelay *bool
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewConfiguration will return a *Configuration.
|
// NewConfiguration will return a *Configuration.
|
||||||
|
@ -246,27 +240,25 @@ func newConfigurationDefaults() Configuration {
|
||||||
IsCentralAuth: false,
|
IsCentralAuth: false,
|
||||||
EnableDebug: false,
|
EnableDebug: false,
|
||||||
|
|
||||||
StartPubREQHello: 30,
|
StartPubREQHello: 30,
|
||||||
StartPubREQKeysRequestUpdate: true,
|
EnableKeyUpdates: true,
|
||||||
StartSubREQKeysDeliverUpdate: true,
|
EnableAclUpdates: true,
|
||||||
StartPubREQAclRequestUpdate: true,
|
StartSubREQErrorLog: false,
|
||||||
StartSubREQAclDeliverUpdate: true,
|
StartSubREQHello: true,
|
||||||
StartSubREQErrorLog: false,
|
StartSubREQToFileAppend: true,
|
||||||
StartSubREQHello: true,
|
StartSubREQToFile: true,
|
||||||
StartSubREQToFileAppend: true,
|
StartSubREQToFileNACK: true,
|
||||||
StartSubREQToFile: true,
|
StartSubREQCopyFileFrom: true,
|
||||||
StartSubREQToFileNACK: true,
|
StartSubREQCopyFileTo: true,
|
||||||
StartSubREQCopyFileFrom: true,
|
StartSubREQPing: true,
|
||||||
StartSubREQCopyFileTo: true,
|
StartSubREQPong: true,
|
||||||
StartSubREQPing: true,
|
StartSubREQCliCommand: true,
|
||||||
StartSubREQPong: true,
|
StartSubREQToConsole: true,
|
||||||
StartSubREQCliCommand: true,
|
StartSubREQHttpGet: true,
|
||||||
StartSubREQToConsole: true,
|
StartSubREQHttpGetScheduled: true,
|
||||||
StartSubREQHttpGet: true,
|
StartSubREQTailFile: true,
|
||||||
StartSubREQHttpGetScheduled: true,
|
StartSubREQCliCommandCont: true,
|
||||||
StartSubREQTailFile: true,
|
StartSubREQRelay: false,
|
||||||
StartSubREQCliCommandCont: true,
|
|
||||||
StartSubREQRelay: false,
|
|
||||||
}
|
}
|
||||||
return c
|
return c
|
||||||
}
|
}
|
||||||
|
@ -460,26 +452,16 @@ func checkConfigValues(cf ConfigurationFromFile) Configuration {
|
||||||
} else {
|
} else {
|
||||||
conf.StartPubREQHello = *cf.StartPubREQHello
|
conf.StartPubREQHello = *cf.StartPubREQHello
|
||||||
}
|
}
|
||||||
if cf.StartPubREQKeysRequestUpdate == nil {
|
if cf.EnableKeyUpdates == nil {
|
||||||
conf.StartPubREQKeysRequestUpdate = cd.StartPubREQKeysRequestUpdate
|
conf.EnableKeyUpdates = cd.EnableKeyUpdates
|
||||||
} else {
|
} else {
|
||||||
conf.StartPubREQKeysRequestUpdate = *cf.StartPubREQKeysRequestUpdate
|
conf.EnableKeyUpdates = *cf.EnableKeyUpdates
|
||||||
}
|
|
||||||
if cf.StartSubREQKeysDeliverUpdate == nil {
|
|
||||||
conf.StartSubREQKeysDeliverUpdate = cd.StartSubREQKeysDeliverUpdate
|
|
||||||
} else {
|
|
||||||
conf.StartSubREQKeysDeliverUpdate = *cf.StartSubREQKeysDeliverUpdate
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if cf.StartPubREQAclRequestUpdate == nil {
|
if cf.EnableAclUpdates == nil {
|
||||||
conf.StartPubREQAclRequestUpdate = cd.StartPubREQAclRequestUpdate
|
conf.EnableAclUpdates = cd.EnableAclUpdates
|
||||||
} else {
|
} else {
|
||||||
conf.StartPubREQAclRequestUpdate = *cf.StartPubREQAclRequestUpdate
|
conf.EnableAclUpdates = *cf.EnableAclUpdates
|
||||||
}
|
|
||||||
if cf.StartSubREQAclDeliverUpdate == nil {
|
|
||||||
conf.StartSubREQAclDeliverUpdate = cd.StartSubREQAclDeliverUpdate
|
|
||||||
} else {
|
|
||||||
conf.StartSubREQAclDeliverUpdate = *cf.StartSubREQAclDeliverUpdate
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if cf.StartSubREQErrorLog == nil {
|
if cf.StartSubREQErrorLog == nil {
|
||||||
|
@ -634,11 +616,9 @@ func (c *Configuration) CheckFlags() error {
|
||||||
|
|
||||||
flag.IntVar(&c.StartPubREQHello, "startPubREQHello", fc.StartPubREQHello, "Make the current node send hello messages to central at given interval in seconds")
|
flag.IntVar(&c.StartPubREQHello, "startPubREQHello", fc.StartPubREQHello, "Make the current node send hello messages to central at given interval in seconds")
|
||||||
|
|
||||||
flag.BoolVar(&c.StartPubREQKeysRequestUpdate, "startPubREQKeysRequestUpdate", fc.StartPubREQKeysRequestUpdate, "true/false")
|
flag.BoolVar(&c.EnableKeyUpdates, "EnableKeyUpdates", fc.EnableKeyUpdates, "true/false")
|
||||||
flag.BoolVar(&c.StartSubREQKeysDeliverUpdate, "startSubREQKeysDeliverUpdate", fc.StartSubREQKeysDeliverUpdate, "true/false")
|
|
||||||
|
|
||||||
flag.BoolVar(&c.StartPubREQAclRequestUpdate, "startPubREQAclRequestUpdate", fc.StartPubREQAclRequestUpdate, "true/false")
|
flag.BoolVar(&c.EnableAclUpdates, "EnableAclUpdates", fc.EnableAclUpdates, "true/false")
|
||||||
flag.BoolVar(&c.StartSubREQAclDeliverUpdate, "startSubREQAclDeliverUpdate", fc.StartSubREQAclDeliverUpdate, "true/false")
|
|
||||||
|
|
||||||
flag.BoolVar(&c.StartSubREQErrorLog, "startSubREQErrorLog", fc.StartSubREQErrorLog, "true/false")
|
flag.BoolVar(&c.StartSubREQErrorLog, "startSubREQErrorLog", fc.StartSubREQErrorLog, "true/false")
|
||||||
flag.BoolVar(&c.StartSubREQHello, "startSubREQHello", fc.StartSubREQHello, "true/false")
|
flag.BoolVar(&c.StartSubREQHello, "startSubREQHello", fc.StartSubREQHello, "true/false")
|
||||||
|
|
|
@ -173,12 +173,12 @@ func (p *processes) Start(proc process) {
|
||||||
proc.startup.pubREQHello(proc)
|
proc.startup.pubREQHello(proc)
|
||||||
}
|
}
|
||||||
|
|
||||||
if proc.configuration.StartPubREQKeysRequestUpdate {
|
if proc.configuration.EnableKeyUpdates {
|
||||||
proc.startup.pubREQKeysRequestUpdate(proc)
|
proc.startup.pubREQKeysRequestUpdate(proc)
|
||||||
proc.startup.subREQKeysDeliverUpdate(proc)
|
proc.startup.subREQKeysDeliverUpdate(proc)
|
||||||
}
|
}
|
||||||
|
|
||||||
if proc.configuration.StartPubREQAclRequestUpdate {
|
if proc.configuration.EnableAclUpdates {
|
||||||
proc.startup.pubREQAclRequestUpdate(proc)
|
proc.startup.pubREQAclRequestUpdate(proc)
|
||||||
proc.startup.subREQAclDeliverUpdate(proc)
|
proc.startup.subREQAclDeliverUpdate(proc)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue