Added execute single message

This commit is contained in:
2021-09-27 10:23:31 +02:00
parent 2c495aa3e4
commit 7765cb32a9
5 changed files with 22 additions and 17 deletions

View File

@@ -33,15 +33,16 @@ Otherwise build the binary like every other golang binary and then copy it.
## Environment variables
| Variable | Required | Default Value | Description |
| ------------------------------------------------- | -------- | --------------------------------- | ------------------------------------------------------------------ |
| **Credentials:** |
| |
| CREDENTIALS_FILE_LOCATION | NO | input.json | Openfire jids and passwords |
| |
| **GeneralOptions:** |
| |
| PRESENCE_STATUS_DELAY | NO | 120000000000 - 2 mins | Delay between two presence status message |
| COMMAND_REPLY_DELAY | NO | 10 sec | Upper limit of random time to wait before sending reply |
| |
| Variable | Required | Default Value | Description |
| ------------------------------------------------- | -------- | --------------------------------- | -----------------------------------------------------------|
| **Credentials:** |
| |
| CREDENTIALS_FILE_LOCATION | NO | input.json | Database username |
| |
| **GeneralOptions:** |
| |
| PRESENCE_STATUS_DELAY | NO | 2 min | Delay for online presence message loop |
| COMMAND_REPLY_DELAY | NO | 10 sec | Delay for command message reply |
| EXECUTE_SIGLE_STATUS_MESSAGE | NO | false | Send one presence stanza message for clients and terminate|
| |

View File

@@ -15,8 +15,9 @@ func Load() {
CredentialsFileLocation: getEnv("CREDENTIALS_FILE_LOCATION", "input.json"),
},
GeneralOptions: GeneralOptions{
PresenceStatusDelay: int64(getEnvInt("PRESENCE_STATUS_DELAY", 2) * 60),
CommandReplyDelay: getEnvInt("COMMAND_REPLY_DELAY", 10),
PresenceStatusDelay: int64(getEnvInt("PRESENCE_STATUS_DELAY", 2) * 60),
CommandReplyDelay: getEnvInt("COMMAND_REPLY_DELAY", 10),
ExecuteSingleStatusMessage: getEnvBool("EXECUTE_SIGLE_STATUS_MESSAGE"),
},
}
}

View File

@@ -21,6 +21,7 @@ type Credentials struct {
// GeneralOptions contains information for general configuration options
type GeneralOptions struct {
PresenceStatusDelay int64
CommandReplyDelay int
PresenceStatusDelay int64
CommandReplyDelay int
ExecuteSingleStatusMessage bool
}

1
go.mod
View File

@@ -9,6 +9,7 @@ require (
require (
github.com/google/uuid v1.1.1 // indirect
github.com/twinj/uuid v1.0.0 // indirect
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7 // indirect
nhooyr.io/websocket v1.6.5 // indirect
)

View File

@@ -1,10 +1,11 @@
package main
import (
appConfig "bitbucket.org/outfrontmedia/rolling-stock-display-simulation-tool/config"
xmppService "bitbucket.org/outfrontmedia/rolling-stock-display-simulation-tool/services"
"log"
"time"
appConfig "bitbucket.org/outfrontmedia/rolling-stock-display-simulation-tool/config"
xmppService "bitbucket.org/outfrontmedia/rolling-stock-display-simulation-tool/services"
)
func main() {