Skip to content

Commit

Permalink
Merge pull request #233 from jammsen/develop
Browse files Browse the repository at this point in the history
Release 2024-02-25.1
  • Loading branch information
jammsen authored Feb 25, 2024
2 parents 75b1b8f + eb1b577 commit 15088e8
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

[Back to main](README.md#changelog)

## 2024-02-25

- Added new mechanic for customization of webhook content-titles (#223)

## 2024-02-24

- Added new mechanic for auto-restart, where the player count will be checked, 15 minutes grace-period (for dungeons, boss-fights, etc.) will only used if a player is online, if not the restart will be initiated (#230)
Expand Down
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ ENV DEBIAN_FRONTEND=noninteractive \
WEBHOOK_ENABLED=false \
WEBHOOK_DEBUG_ENABLED=false \
WEBHOOK_URL= \
WEBHOOK_CONTENT_TITLE="Status update" \
WEBHOOK_INFO_TITLE="Info" \
WEBHOOK_INFO_DESCRIPTION="This is an info from the server" \
WEBHOOK_INFO_COLOR="2849520" \
Expand Down
1 change: 1 addition & 0 deletions default.env
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ RCON_PLAYER_DETECTION_CHECK_INTERVAL=15
WEBHOOK_ENABLED=false
WEBHOOK_DEBUG_ENABLED=false
WEBHOOK_URL="YOUR-URL-IN-HERE"
WEBHOOK_CONTENT_TITLE="Status update"
WEBHOOK_INFO_TITLE="Info"
WEBHOOK_INFO_DESCRIPTION="This is an info from the server"
WEBHOOK_INFO_COLOR="2849520"
Expand Down
3 changes: 2 additions & 1 deletion docs/ENV_VARS.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,15 @@ These settings control the behavior of the Docker container:
| BACKUP_RETENTION_POLICY | Set to enabled, will cleanup old backups | true | Boolean |
| BACKUP_RETENTION_AMOUNT_TO_KEEP | Defines how many backups in numbers to keep | 72 | Integer |
| RESTART_ENABLED | Automatic restarts the server | false | Boolean |
| RESTART_DEBUG_OVERRIDE | Automatic restarts down to 15 seconds instead of 15 minutes | false | Boolean |
| RESTART_DEBUG_OVERRIDE | Automatic restarts down to 15 seconds instead of 15 minutes | false | Boolean |
| RESTART_CRON_EXPRESSION | Needs a Cron-Expression - See [Cron expression](#cron-expression) | 0 3,15 * * * | Cron-Expression |
| RCON_PLAYER_DETECTION | Set to enabled will send player join and leaves to console, rcon and webhooks, NEEDS `RCON_ENABLED` | true | Boolean |
| RCON_PLAYER_DETECTION_STARTUP_DELAY | Initial delay for start checking for players, consider steam-updates and server start up in seconds | 60 | Integer |
| RCON_PLAYER_DETECTION_CHECK_INTERVAL | Interval in seconds to wait for next check in the infinite loop | 15 | Integer |
| WEBHOOK_ENABLED | Set to enabled will send webhook notifications, NEEDS `WEBHOOK_URL` | false | Boolean |
| WEBHOOK_DEBUG_ENABLED | Set to enabled will enable feedback of curl and not use --silent | false | Boolean |
| WEBHOOK_URL | Defines the url the webhook to send data to | | Url |
| WEBHOOK_CONTENT_TITLE | If set to a value this will add the "content" segment for the webhook, set to empty removes it | Status update | String |
| WEBHOOK_* | See below the table "Webhook environment variables" | | String |
| SERVER_SETTINGS_MODE | Determines whether settings can be modified via environment variables or via file, except `COMMUNITY_SERVER` and `MULTITHREAD_ENABLED`! | `auto` | Enum |

Expand Down
16 changes: 14 additions & 2 deletions includes/webhook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,28 @@
# IMPORTANT: Don't use Hex-Colors! Go to the page, search for the Hex-Color,
# after that add the DECIMAL-Representation to the color field or it will break for Discord!
generate_post_data() {
cat <<EOF
if [[ -n "${WEBHOOK_CONTENT_TITLE}" ]]; then
cat <<EOF
{
"content": "Status update",
"content": "${WEBHOOK_CONTENT_TITLE}",
"embeds": [{
"title": "$1",
"description": "$2",
"color": "$3"
}]
}
EOF
else
cat <<EOF
{
"embeds": [{
"title": "$1",
"description": "$2",
"color": "$3"
}]
}
EOF
fi
}

send_webhook_notification() {
Expand Down

0 comments on commit 15088e8

Please sign in to comment.