Major refactoring
This commit is contained in:
27
commands/executor.go
Normal file
27
commands/executor.go
Normal file
@@ -0,0 +1,27 @@
|
||||
package commands
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"os/signal"
|
||||
"syscall"
|
||||
|
||||
"git.nevets.tech/Keys/CertManager/executor"
|
||||
)
|
||||
|
||||
var executorServer *executor.Server
|
||||
|
||||
func StartExecutorCmd() error {
|
||||
executorServer = &executor.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
|
||||
}
|
||||
Reference in New Issue
Block a user