33 lines
735 B
Go
33 lines
735 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
|
|
"go.temporal.io/sdk/client"
|
|
"go.temporal.io/sdk/worker"
|
|
"my-homelab-configs/internal/jeannieworkflow"
|
|
)
|
|
|
|
func main() {
|
|
address := os.Getenv("JEANNIE_TEMPORAL_ADDRESS")
|
|
if address == "" {
|
|
address = "127.0.0.1:7233"
|
|
}
|
|
taskQueue := os.Getenv("JEANNIE_TEMPORAL_TASK_QUEUE")
|
|
if taskQueue == "" {
|
|
taskQueue = jeannieworkflow.TaskQueue
|
|
}
|
|
c, err := client.Dial(client.Options{HostPort: address})
|
|
if err != nil {
|
|
panic(fmt.Errorf("connect to Temporal: %w", err))
|
|
}
|
|
defer c.Close()
|
|
w := worker.New(c, taskQueue, worker.Options{})
|
|
w.RegisterWorkflow(jeannieworkflow.Workflow)
|
|
w.RegisterActivity(jeannieworkflow.Run)
|
|
if err := w.Run(worker.InterruptCh()); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|