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 ## Environment variables
| Variable | Required | Default Value | Description | | Variable | Required | Default Value | Description |
| ------------------------------------------------- | -------- | --------------------------------- | ------------------------------------------------------------------ | | ------------------------------------------------- | -------- | --------------------------------- | -----------------------------------------------------------|
| **Credentials:** | | **Credentials:** |
| | | |
| CREDENTIALS_FILE_LOCATION | NO | input.json | Openfire jids and passwords | | CREDENTIALS_FILE_LOCATION | NO | input.json | Database username |
| | | |
| **GeneralOptions:** | | **GeneralOptions:** |
| | | |
| PRESENCE_STATUS_DELAY | NO | 120000000000 - 2 mins | Delay between two presence status message | | PRESENCE_STATUS_DELAY | NO | 2 min | Delay for online presence message loop |
| COMMAND_REPLY_DELAY | NO | 10 sec | Upper limit of random time to wait before sending reply | | 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"), CredentialsFileLocation: getEnv("CREDENTIALS_FILE_LOCATION", "input.json"),
}, },
GeneralOptions: GeneralOptions{ GeneralOptions: GeneralOptions{
PresenceStatusDelay: int64(getEnvInt("PRESENCE_STATUS_DELAY", 2) * 60), PresenceStatusDelay: int64(getEnvInt("PRESENCE_STATUS_DELAY", 2) * 60),
CommandReplyDelay: getEnvInt("COMMAND_REPLY_DELAY", 10), 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 // GeneralOptions contains information for general configuration options
type GeneralOptions struct { type GeneralOptions struct {
PresenceStatusDelay int64 PresenceStatusDelay int64
CommandReplyDelay int CommandReplyDelay int
ExecuteSingleStatusMessage bool
} }

1
go.mod
View File

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

View File

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