Fix for Hatchet Lite to still properly fallback to using the postgres message queue kind (#2392)

* fix for lite postgres msg kind

* support legacy flags as well
This commit is contained in:
Mohammed Nafees
2025-10-16 18:54:25 +02:00
committed by GitHub
parent e2b1f1353e
commit 0ef001c5ce

View File

@@ -17,7 +17,6 @@ import (
"github.com/hatchet-dev/hatchet/cmd/hatchet-staticfileserver/staticfileserver" "github.com/hatchet-dev/hatchet/cmd/hatchet-staticfileserver/staticfileserver"
"github.com/hatchet-dev/hatchet/pkg/cmdutils" "github.com/hatchet-dev/hatchet/pkg/cmdutils"
"github.com/hatchet-dev/hatchet/pkg/config/loader" "github.com/hatchet-dev/hatchet/pkg/config/loader"
"github.com/hatchet-dev/hatchet/pkg/config/server"
) )
var printVersion bool var printVersion bool
@@ -92,11 +91,21 @@ func start(cf *loader.ConfigLoader, interruptCh <-chan interface{}, version stri
return fmt.Errorf("error parsing frontend URL: %w", err) return fmt.Errorf("error parsing frontend URL: %w", err)
} }
_, sc, err := cf.CreateServerFromConfig(version, func(cf *server.ServerConfigFile) { _, msgQueueKindSet := os.LookupEnv("SERVER_MSGQUEUE_KIND")
if cf.MessageQueue.RabbitMQ.URL == "" { _, msgQueueRabbitMQURLSet := os.LookupEnv("SERVER_MSGQUEUE_RABBITMQ_URL")
cf.MessageQueue.Kind = "postgres" // for legacy reasons let us also check for these two variables
_, taskQueueKindSet := os.LookupEnv("SERVER_TASKQUEUE_KIND")
_, taskQueueRabbitMQURLSet := os.LookupEnv("SERVER_TASKQUEUE_RABBITMQ_URL")
if !msgQueueKindSet && !msgQueueRabbitMQURLSet && !taskQueueKindSet && !taskQueueRabbitMQURLSet {
err := os.Setenv("SERVER_MSGQUEUE_KIND", "postgres")
if err != nil {
return fmt.Errorf("error setting SERVER_MSGQUEUE_KIND to postgres: %w", err)
} }
}) }
_, sc, err := cf.CreateServerFromConfig(version)
if err != nil { if err != nil {
return fmt.Errorf("error loading server config: %w", err) return fmt.Errorf("error loading server config: %w", err)