diff --git a/README.md b/README.md index 7371628..099cad4 100644 --- a/README.md +++ b/README.md @@ -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| +| | diff --git a/config/config.go b/config/config.go index 55b3a0f..cf5fb7a 100644 --- a/config/config.go +++ b/config/config.go @@ -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"), }, } } diff --git a/config/models.go b/config/models.go index b23de43..b471e4b 100644 --- a/config/models.go +++ b/config/models.go @@ -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 } diff --git a/go.mod b/go.mod index 65aef79..c3c93cf 100644 --- a/go.mod +++ b/go.mod @@ -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 ) diff --git a/main.go b/main.go index 323ff98..d8c6e31 100644 --- a/main.go +++ b/main.go @@ -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() {