updating haven notify
This commit is contained in:
@@ -9,4 +9,5 @@ FROM busybox:latest
|
||||
WORKDIR /app
|
||||
COPY --from=builder /app/haven-notify .
|
||||
EXPOSE 8080
|
||||
ENV WEBHOOK_URL=""
|
||||
ENTRYPOINT ["/app/haven-notify"]
|
||||
|
@@ -20,6 +20,12 @@ spec:
|
||||
imagePullPolicy: Always
|
||||
ports:
|
||||
- containerPort: 8080
|
||||
env:
|
||||
- name: WEBHOOK_URL
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: discord-webhook
|
||||
key: HAVEN_WEBHOOK_URL
|
||||
nodeSelector:
|
||||
kubernetes.io/arch: amd64
|
||||
---
|
||||
|
@@ -7,6 +7,7 @@ import (
|
||||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
)
|
||||
|
||||
// Notification payload
|
||||
@@ -47,7 +48,10 @@ func notifyHandler(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func sendDiscordNotification(title, message string) error {
|
||||
const webhookURL = ""
|
||||
webhookURL := os.Getenv("WEBHOOK_URL")
|
||||
if webhookURL == "" {
|
||||
return fmt.Errorf("WEBHOOK_URL environment variable not set")
|
||||
}
|
||||
|
||||
// Discord webhook payload
|
||||
type discordPayload struct {
|
||||
|
Reference in New Issue
Block a user