NotifyContext when running services standalone

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
This commit is contained in:
Jörn Friedrich Dreyer
2024-07-24 13:26:50 +02:00
parent d6045a74ea
commit 7a22dfb6de
41 changed files with 246 additions and 41 deletions

View File

@@ -1,14 +1,19 @@
package main
import (
"context"
"os"
"os/signal"
"syscall"
"github.com/owncloud/ocis/v2/services/postprocessing/pkg/command"
"github.com/owncloud/ocis/v2/services/postprocessing/pkg/config/defaults"
)
func main() {
if err := command.Execute(defaults.DefaultConfig()); err != nil {
cfg := defaults.DefaultConfig()
cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM)
if err := command.Execute(cfg); err != nil {
os.Exit(1)
}
}