Skip to content
This repository was archived by the owner on Oct 19, 2024. It is now read-only.

Commit c298b1a

Browse files
authored
feat: Add configuration argument for slack bot handler (#304)
Signed-off-by: Sergey Shevchenko <[email protected]>
1 parent 19759bd commit c298b1a

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

cmd/bot.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package main
22

33
import (
4+
"fmt"
5+
46
"github.com/argoproj/notifications-engine/pkg/api"
57

68
"github.com/spf13/cobra"
@@ -19,6 +21,7 @@ func newBotCommand() *cobra.Command {
1921
clientConfig clientcmd.ClientConfig
2022
namespace string
2123
port int
24+
slackPath string
2225
)
2326
var command = cobra.Command{
2427
Use: "bot",
@@ -48,12 +51,13 @@ func newBotCommand() *cobra.Command {
4851
k8s.NewSecretInformer(clientset, namespace), k8s.NewConfigMapInformer(clientset, namespace))
4952

5053
server := bot.NewServer(dynamicClient, namespace)
51-
server.AddAdapter("/slack", slack.NewSlackAdapter(slack.NewVerifier(apiFactory)))
54+
server.AddAdapter(fmt.Sprintf("/%s", slackPath), slack.NewSlackAdapter(slack.NewVerifier(apiFactory)))
5255
return server.Serve(port)
5356
},
5457
}
5558
clientConfig = k8s.AddK8SFlagsToCmd(&command)
5659
command.Flags().IntVar(&port, "port", 8080, "Port number.")
5760
command.Flags().StringVar(&namespace, "namespace", "", "Namespace which bot handles. Current namespace if empty.")
61+
command.Flags().StringVar(&slackPath, "slack-path", "slack", "Path to the slack bot handler")
5862
return &command
5963
}

docs/bots/overview.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ The bot is not installed by default. Use the `install-bot.yaml` to intall it:
77
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj-labs/argocd-notifications/stable/manifests/install-bot.yaml
88
```
99

10+
!!! note
11+
You can edit deployment and change some arguments such as `--port`, `--namespace` or `slack-path`flag in `argocd-notifications-controller` deployment.
12+
1013
* [Slack bot](./slack-bot.md)
1114
* [Opsgenie bot](./opsgenie-bot.md)
1215
* [Telegram bot](./telegram-bot.md)

0 commit comments

Comments
 (0)