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

Renamed REQTextToConsole to REQToConsole

This commit is contained in:
postmannen 2021-04-13 17:22:25 +02:00
parent 08f6f21691
commit ba06ffde5b
5 changed files with 35 additions and 35 deletions

View file

@ -164,7 +164,7 @@ clone the repository, then cd `./steward/cmd` and do `go build -o steward`, and
Specify comma separated list for nodes to allow messages from. Use "*" for from all. Value RST will turn off subscriber.
-startSubREQPong value
Specify comma separated list for nodes to allow messages from. Use "*" for from all. Value RST will turn off subscriber.
-startSubREQTextToConsole value
-startSubREQToConsole value
Specify comma separated list for nodes to allow messages from. Use "*" for from all. Value RST will turn off subscriber.
-startSubREQToFileAppend value
Specify comma separated list for nodes to allow messages from. Use "*" for from all. Value RST will turn off subscriber.

View file

@ -116,8 +116,8 @@ type Configuration struct {
StartSubREQCliCommand flagNodeSlice
// Subscriber for REQnCliCommand
StartSubREQnCliCommand flagNodeSlice
// Subscriber for REQTextToConsole
StartSubREQTextToConsole flagNodeSlice
// Subscriber for REQToConsole
StartSubREQToConsole flagNodeSlice
// Subscriber for REQHttpGet
StartSubREQHttpGet flagNodeSlice
// Subscriber for tailing log files
@ -134,26 +134,26 @@ func NewConfiguration() *Configuration {
// Default configuration
func newConfigurationDefaults() Configuration {
c := Configuration{
ConfigFolder: "./etc",
BrokerAddress: "127.0.0.1:4222",
ProfilingPort: "",
PromHostAndPort: "",
DefaultMessageTimeout: 10,
DefaultMessageRetries: 1,
StartPubREQHello: 30,
SubscribersDataFolder: "./var",
CentralNodeName: "",
StartSubREQErrorLog: flagNodeSlice{Values: []node{}},
StartSubREQHello: flagNodeSlice{OK: true, Values: []node{"*"}},
StartSubREQToFileAppend: flagNodeSlice{OK: true, Values: []node{"*"}},
StartSubREQToFile: flagNodeSlice{OK: true, Values: []node{"*"}},
StartSubREQPing: flagNodeSlice{OK: true, Values: []node{"*"}},
StartSubREQPong: flagNodeSlice{OK: true, Values: []node{"*"}},
StartSubREQCliCommand: flagNodeSlice{OK: true, Values: []node{"*"}},
StartSubREQnCliCommand: flagNodeSlice{OK: true, Values: []node{"*"}},
StartSubREQTextToConsole: flagNodeSlice{OK: true, Values: []node{"*"}},
StartSubREQHttpGet: flagNodeSlice{OK: true, Values: []node{"*"}},
StartSubREQTailFile: flagNodeSlice{OK: true, Values: []node{"*"}},
ConfigFolder: "./etc",
BrokerAddress: "127.0.0.1:4222",
ProfilingPort: "",
PromHostAndPort: "",
DefaultMessageTimeout: 10,
DefaultMessageRetries: 1,
StartPubREQHello: 30,
SubscribersDataFolder: "./var",
CentralNodeName: "",
StartSubREQErrorLog: flagNodeSlice{Values: []node{}},
StartSubREQHello: flagNodeSlice{OK: true, Values: []node{"*"}},
StartSubREQToFileAppend: flagNodeSlice{OK: true, Values: []node{"*"}},
StartSubREQToFile: flagNodeSlice{OK: true, Values: []node{"*"}},
StartSubREQPing: flagNodeSlice{OK: true, Values: []node{"*"}},
StartSubREQPong: flagNodeSlice{OK: true, Values: []node{"*"}},
StartSubREQCliCommand: flagNodeSlice{OK: true, Values: []node{"*"}},
StartSubREQnCliCommand: flagNodeSlice{OK: true, Values: []node{"*"}},
StartSubREQToConsole: flagNodeSlice{OK: true, Values: []node{"*"}},
StartSubREQHttpGet: flagNodeSlice{OK: true, Values: []node{"*"}},
StartSubREQTailFile: flagNodeSlice{OK: true, Values: []node{"*"}},
}
return c
}
@ -194,7 +194,7 @@ func (c *Configuration) CheckFlags() error {
flag.Var(&c.StartSubREQPong, "startSubREQPong", "Specify comma separated list for nodes to allow messages from. Use \"*\" for from all. Value RST will turn off subscriber.")
flag.Var(&c.StartSubREQCliCommand, "startSubREQCliCommand", "Specify comma separated list for nodes to allow messages from. Use \"*\" for from all. Value RST will turn off subscriber.")
flag.Var(&c.StartSubREQnCliCommand, "startSubREQnCliCommand", "Specify comma separated list for nodes to allow messages from. Use \"*\" for from all. Value RST will turn off subscriber.")
flag.Var(&c.StartSubREQTextToConsole, "startSubREQTextToConsole", "Specify comma separated list for nodes to allow messages from. Use \"*\" for from all. Value RST will turn off subscriber.")
flag.Var(&c.StartSubREQToConsole, "startSubREQToConsole", "Specify comma separated list for nodes to allow messages from. Use \"*\" for from all. Value RST will turn off subscriber.")
flag.Var(&c.StartSubREQHttpGet, "startSubREQHttpGet", "Specify comma separated list for nodes to allow messages from. Use \"*\" for from all. Value RST will turn off subscriber.")
flag.Var(&c.StartSubREQTailFile, "startSubREQTailFile", "Specify comma separated list for nodes to allow messages from. Use \"*\" for from all. Value RST will turn off subscriber.")

View file

@ -37,7 +37,7 @@ SubscribersDataFolder = "./var"
OK = false
Values = []
[StartSubREQTextToConsole]
[StartSubREQToConsole]
OK = true
Values = ["*"]

View file

@ -63,8 +63,8 @@ func (p process) ProcessesStart() {
}
// Start a subscriber for CLICommandReply messages
if p.configuration.StartSubREQTextToConsole.OK {
p.startup.subREQTextToConsole(p)
if p.configuration.StartSubREQToConsole.OK {
p.startup.subREQToConsole(p)
}
if p.configuration.StartPubREQHello != 0 {
@ -137,10 +137,10 @@ func (s startup) pubREQHello(p process) {
go proc.spawnWorker(p.processes, p.natsConn)
}
func (s startup) subREQTextToConsole(p process) {
func (s startup) subREQToConsole(p process) {
fmt.Printf("Starting Text To Console subscriber: %#v\n", p.node)
sub := newSubject(REQTextToConsole, string(p.node))
proc := newProcess(p.natsConn, p.processes, p.toRingbufferCh, p.configuration, sub, p.errorCh, processKindSubscriber, p.configuration.StartSubREQTextToConsole.Values, nil)
sub := newSubject(REQToConsole, string(p.node))
proc := newProcess(p.natsConn, p.processes, p.toRingbufferCh, p.configuration, sub, p.errorCh, processKindSubscriber, p.configuration.StartSubREQToConsole.Values, nil)
go proc.spawnWorker(p.processes, p.natsConn)
}

View file

@ -86,7 +86,7 @@ const (
// Send text to be logged to the console.
// The data field is a slice of strings where the first string
// value should be the command, and the following the arguments.
REQTextToConsole Method = "REQTextToConsole"
REQToConsole Method = "REQToConsole"
// Send text logging to some host by appending the output to a
// file, if the file do not exist we create it.
// A file with the full subject+hostName will be created on
@ -143,7 +143,7 @@ func (m Method) GetMethodsAvailable() MethodsAvailable {
REQnCliCommand: methodREQnCliCommand{
commandOrEvent: CommandACK,
},
REQTextToConsole: methodREQTextToConsole{
REQToConsole: methodREQToConsole{
commandOrEvent: EventACK,
},
REQToFileAppend: methodREQToFileAppend{
@ -790,15 +790,15 @@ func (m methodREQnCliCommand) handler(proc process, message Message, node string
// ---
type methodREQTextToConsole struct {
type methodREQToConsole struct {
commandOrEvent CommandOrEvent
}
func (m methodREQTextToConsole) getKind() CommandOrEvent {
func (m methodREQToConsole) getKind() CommandOrEvent {
return m.commandOrEvent
}
func (m methodREQTextToConsole) handler(proc process, message Message, node string) ([]byte, error) {
func (m methodREQToConsole) handler(proc process, message Message, node string) ([]byte, error) {
fmt.Printf("<--- methodCLICommandReply: %v\n", message.Data)
ackMsg := []byte("confirmed from: " + node + ": " + fmt.Sprint(message.ID))