Skip to content
This repository has been archived by the owner on Jan 11, 2021. It is now read-only.

Added GREETING_MESSAGE config #67

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ Additionally, the following environment variables can be used:
- `SLACK_USERNAME`: Override username to send
- `SLACK_PROXY`: URL of HTTP proxy used to connect to Slack
- `RECOVERY_ALERT`: Set to `false` to disable alert on pod recovery
- `GREETING_MESSAGE`: Text to insert at begining message

## Annotations

Expand Down
1 change: 1 addition & 0 deletions config/custom-environment-variables.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ slack_url: SLACK_URL
slack_channel: SLACK_CHANNEL
slack_username: SLACK_USERNAME
slack_proxy: SLACK_PROXY
greeting_message: GREETING_MESSAGE
6 changes: 5 additions & 1 deletion src/notify/slack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,15 @@ export default class SlackNotifier {

let channel = item.channel || config.get('slack_channel');
let username = item.username || config.get('slack_username');
let message = item.text || 'Kubernetes Notification:';
if (config.has('greeting_message')) {
message = config.get('greeting_message') + "\n" + message;
}
delete item.channel;

return this.slack
.send({
text: item.text || 'Kubernetes Notification:',
text: message,
attachments: [item],
channel,
username
Expand Down