Skip to content

Commit

Permalink
Updates to slack handling
Browse files Browse the repository at this point in the history
  • Loading branch information
ZIJ committed Oct 2, 2024
1 parent 876fb40 commit 6c9a077
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 56 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/fly-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# See https://fly.io/docs/app-guides/continuous-deployment-with-github-actions/

name: Fly Deploy
on:
push:
branches:
- main
jobs:
deploy:
name: Deploy app
runs-on: ubuntu-latest
concurrency: deploy-group # optional: ensure only one action runs at a time
steps:
- uses: actions/checkout@v4
- uses: superfly/flyctl-actions/setup-flyctl@master
- run: flyctl deploy --remote-only
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
44 changes: 0 additions & 44 deletions ee/drift/Dockerfile

This file was deleted.

16 changes: 11 additions & 5 deletions ee/drift/controllers/notifications.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,17 @@ import (
"bytes"
"encoding/json"
"fmt"
"github.com/diggerhq/digger/ee/drift/dbmodels"
"github.com/diggerhq/digger/ee/drift/model"
utils2 "github.com/diggerhq/digger/next/utils"
"github.com/gin-gonic/gin"
"github.com/slack-go/slack"
"log"
"net/http"
"net/url"
"os"
"time"

"github.com/diggerhq/digger/ee/drift/dbmodels"
"github.com/diggerhq/digger/ee/drift/model"
utils2 "github.com/diggerhq/digger/next/utils"
"github.com/gin-gonic/gin"
"github.com/slack-go/slack"
)

func sendTestSlackWebhook(webhookURL string) error {
Expand Down Expand Up @@ -88,6 +89,11 @@ func (mc MainController) SendTestSlackNotificationForOrg(c *gin.Context) {

os := dbmodels.DB.Query.OrgSetting
orgSettings, err := dbmodels.DB.Query.OrgSetting.Where(os.OrgID.Eq(orgId)).First()
if err != nil {
log.Printf("Error reading org: %v", err)
c.JSON(http.StatusInternalServerError, gin.H{"error": "Error reading org"})
return
}

slackNotificationUrl := orgSettings.SlackNotificationURL

Expand Down
9 changes: 5 additions & 4 deletions ee/drift/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ package main

import (
"fmt"
"log"
"log/slog"
"net/http"
"os"

"github.com/diggerhq/digger/backend/ci_backends"
"github.com/diggerhq/digger/ee/drift/controllers"
"github.com/diggerhq/digger/ee/drift/dbmodels"
Expand All @@ -11,10 +16,6 @@ import (
sentrygin "github.com/getsentry/sentry-go/gin"
"github.com/gin-gonic/gin"
sloggin "github.com/samber/slog-gin"
"log"
"log/slog"
"net/http"
"os"
)

func init() {
Expand Down
9 changes: 6 additions & 3 deletions ee/drift/fly.toml → fly-drift-igor-dev.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
# fly.toml app configuration file generated for driftapp-backend on 2024-09-23T18:02:57+01:00
# fly.toml app configuration file generated for driftapp-backend-igor-dev-late-hill-6194 on 2024-09-25T17:22:20+01:00
#
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#

app = 'driftapp-backend'
app = 'driftapp-backend-igor-dev-late-hill-6194'
primary_region = 'lhr'
kill_signal = 'SIGINT'
kill_timeout = '5s'

[build]
dockerfile = 'Dockerfile'
dockerfile = 'Dockerfile_drift'

[env]
DIGGER_HOSTNAME = 'https://driftapp-backend.digger.dev'

[[services]]
protocol = 'tcp'
Expand Down

0 comments on commit 6c9a077

Please sign in to comment.