updating haven notify
All checks were successful
Check scripts syntax / check-scripts-syntax (push) Successful in 3s
Haven Notify Build and Deploy / Build Haven Notify Image (amd64) (push) Successful in 15s
Haven Notify Build and Deploy / Deploy Haven Notify (push) Successful in 11s

This commit is contained in:
2025-08-16 22:41:41 -03:00
parent cbd813a76e
commit 018a4a5d60
3 changed files with 16 additions and 5 deletions

View File

@@ -9,4 +9,5 @@ FROM busybox:latest
WORKDIR /app WORKDIR /app
COPY --from=builder /app/haven-notify . COPY --from=builder /app/haven-notify .
EXPOSE 8080 EXPOSE 8080
ENV WEBHOOK_URL=""
ENTRYPOINT ["/app/haven-notify"] ENTRYPOINT ["/app/haven-notify"]

View File

@@ -20,6 +20,12 @@ spec:
imagePullPolicy: Always imagePullPolicy: Always
ports: ports:
- containerPort: 8080 - containerPort: 8080
env:
- name: WEBHOOK_URL
valueFrom:
secretKeyRef:
name: discord-webhook
key: HAVEN_WEBHOOK_URL
nodeSelector: nodeSelector:
kubernetes.io/arch: amd64 kubernetes.io/arch: amd64
--- ---

View File

@@ -7,6 +7,7 @@ import (
"fmt" "fmt"
"log" "log"
"net/http" "net/http"
"os"
) )
// Notification payload // Notification payload
@@ -47,7 +48,10 @@ func notifyHandler(w http.ResponseWriter, r *http.Request) {
} }
func sendDiscordNotification(title, message string) error { 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 // Discord webhook payload
type discordPayload struct { type discordPayload struct {