1
0
Fork 0
mirror of https://github.com/postmannen/ctrl.git synced 2025-01-07 04:49:17 +00:00

replaced keys/acl startREQ flags with enable flag

This commit is contained in:
postmannen 2022-05-30 07:14:15 +02:00
parent 592425d53c
commit 368ac6e661
2 changed files with 52 additions and 72 deletions

View file

@ -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
@ -179,10 +175,8 @@ type ConfigurationFromFile struct {
EnableDebug *bool EnableDebug *bool
StartPubREQHello *int StartPubREQHello *int
StartPubREQKeysRequestUpdate *bool EnableKeyUpdates *bool
StartSubREQKeysDeliverUpdate *bool EnableAclUpdates *bool
StartPubREQAclRequestUpdate *bool
StartSubREQAclDeliverUpdate *bool
StartSubREQErrorLog *bool StartSubREQErrorLog *bool
StartSubREQHello *bool StartSubREQHello *bool
StartSubREQToFileAppend *bool StartSubREQToFileAppend *bool
@ -247,10 +241,8 @@ func newConfigurationDefaults() Configuration {
EnableDebug: false, EnableDebug: false,
StartPubREQHello: 30, StartPubREQHello: 30,
StartPubREQKeysRequestUpdate: true, EnableKeyUpdates: true,
StartSubREQKeysDeliverUpdate: true, EnableAclUpdates: true,
StartPubREQAclRequestUpdate: true,
StartSubREQAclDeliverUpdate: true,
StartSubREQErrorLog: false, StartSubREQErrorLog: false,
StartSubREQHello: true, StartSubREQHello: true,
StartSubREQToFileAppend: true, StartSubREQToFileAppend: true,
@ -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")

View file

@ -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)
} }