Files
certman/app/executor/commands.go
Steven Tracey e0f68788c0
Some checks failed
Build (artifact) / build (push) Failing after 1m3s
Major Refactoring, Client can now be used as a library
2026-03-16 21:48:32 +01:00

38 lines
634 B
Go

package executor
import (
"fmt"
"os"
"os/signal"
"syscall"
"github.com/spf13/cobra"
)
var (
executorServer *Server
ExecutorCmd = &cobra.Command{
Use: "executor",
Short: "Privileged daemon",
RunE: func(cmd *cobra.Command, args []string) error {
return startExecutorCmd()
},
}
)
func startExecutorCmd() error {
executorServer = &Server{}
sigCh := make(chan os.Signal, 1)
signal.Notify(sigCh, syscall.SIGINT, syscall.SIGTERM)
go func() {
<-sigCh
executorServer.Stop()
}()
if err := executorServer.Start(); err != nil {
return fmt.Errorf("failed to start executor server: %w", err)
}
return nil
}