bugfix
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2025-03-24 10:15:04 +11:00
parent 789805b587
commit 6c432f7cb1
3 changed files with 10 additions and 5 deletions

10
main.go
View File

@@ -1,16 +1,17 @@
package main package main
import ( import (
"context"
"fmt" "fmt"
"os"
"runtime"
"time"
"mocksnow/db" "mocksnow/db"
"mocksnow/internal/settings" "mocksnow/internal/settings"
utils "mocksnow/internal/utils" utils "mocksnow/internal/utils"
"mocksnow/log" "mocksnow/log"
"mocksnow/server" "mocksnow/server"
"mocksnow/server/router" "mocksnow/server/router"
"os"
"runtime"
"time"
"github.com/go-co-op/gocron/v2" "github.com/go-co-op/gocron/v2"
"github.com/joho/godotenv" "github.com/joho/godotenv"
@@ -38,6 +39,7 @@ func main() {
log.GetOutput(), log.GetOutput(),
) )
_, cancel := context.WithCancel(context.Background())
//ctx, cancel := context.WithCancel(context.Background()) //ctx, cancel := context.WithCancel(context.Background())
// Configure database // Configure database
@@ -217,7 +219,7 @@ func main() {
svr := server.New( svr := server.New(
logger, logger,
c, c,
//cancel, cancel,
bindAddress, bindAddress,
server.WithRouter(r), server.WithRouter(r),
server.SetTls(bindDisableTls), server.SetTls(bindDisableTls),

View File

@@ -30,6 +30,9 @@ func New(logger *slog.Logger, database db.Database, buildTime string, sha1ver st
mux.HandleFunc("/api/now/import/x_dusa2_itom_inc_imp", h.NewSnow) mux.HandleFunc("/api/now/import/x_dusa2_itom_inc_imp", h.NewSnow)
mux.HandleFunc("/api/now/table/incident/", h.GetIncident) mux.HandleFunc("/api/now/table/incident/", h.GetIncident)
mux.HandleFunc("/api/print", h.RenderIncomingTable)
// TODO - fallback route that will just echo incoming payload
// mux.HandleFunc("/api/event/vm/create", h.VmCreateEvent) // mux.HandleFunc("/api/event/vm/create", h.VmCreateEvent)
// mux.HandleFunc("/api/event/vm/modify", h.VmModifyEvent) // mux.HandleFunc("/api/event/vm/modify", h.VmModifyEvent)

View File

@@ -25,7 +25,7 @@ type Server struct {
} }
// New creates a new server with the given logger, address and options. // New creates a new server with the given logger, address and options.
func New(logger *slog.Logger, cron gocron.Scheduler, addr string, opts ...Option) *Server { func New(logger *slog.Logger, cron gocron.Scheduler, cancel context.CancelFunc, addr string, opts ...Option) *Server {
// Set some options for TLS // Set some options for TLS
tlsConfig := &tls.Config{ tlsConfig := &tls.Config{