From 7a22dfb6debdf5f6038377b8aa998fa9f9ef2d30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Friedrich=20Dreyer?= Date: Wed, 24 Jul 2024 13:26:50 +0200 Subject: [PATCH] NotifyContext when running services standalone MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jörn Friedrich Dreyer --- services/activitylog/cmd/activitylog/main.go | 7 ++++++- services/antivirus/cmd/antivirus/main.go | 7 ++++++- services/app-provider/cmd/app-provider/main.go | 7 ++++++- services/app-registry/cmd/app-registry/main.go | 7 ++++++- services/audit/cmd/audit/main.go | 7 ++++++- services/auth-app/cmd/auth-app/main.go | 7 ++++++- services/auth-basic/cmd/auth-basic/main.go | 7 ++++++- services/auth-bearer/cmd/auth-bearer/main.go | 7 ++++++- services/auth-machine/cmd/auth-machine/main.go | 7 ++++++- services/auth-service/cmd/auth-service/main.go | 7 ++++++- services/clientlog/cmd/clientlog/main.go | 7 ++++++- services/eventhistory/cmd/eventhistory/main.go | 7 ++++++- services/frontend/cmd/frontend/main.go | 7 ++++++- services/graph/cmd/graph/main.go | 7 ++++++- services/groups/cmd/groups/main.go | 7 ++++++- services/idm/cmd/idm/main.go | 7 ++++++- services/idp/cmd/idp/main.go | 7 ++++++- services/invitations/cmd/invitations/main.go | 7 ++++++- services/nats/cmd/nats/main.go | 7 ++++++- services/notifications/cmd/notifications/main.go | 7 ++++++- services/ocdav/cmd/ocdav/main.go | 7 ++++++- services/ocm/cmd/ocm/main.go | 7 ++++++- services/ocs/cmd/ocs/main.go | 7 ++++++- services/policies/cmd/policies/main.go | 7 ++++++- services/postprocessing/cmd/postprocessing/main.go | 7 ++++++- services/proxy/cmd/proxy/main.go | 7 ++++++- services/search/cmd/search/main.go | 7 ++++++- services/settings/cmd/settings/main.go | 7 ++++++- services/sharing/cmd/sharing/main.go | 7 ++++++- services/sse/cmd/sse/main.go | 7 ++++++- services/storage-publiclink/cmd/storage-publiclink/main.go | 7 ++++++- services/storage-shares/cmd/storage-shares/main.go | 7 ++++++- services/storage-system/cmd/storage-system/main.go | 7 ++++++- services/storage-users/cmd/storage-users/main.go | 7 ++++++- services/store/cmd/store/main.go | 7 ++++++- services/thumbnails/cmd/thumbnails/main.go | 7 ++++++- services/userlog/cmd/userlog/main.go | 7 ++++++- services/users/cmd/user/main.go | 7 ++++++- services/web/cmd/web/main.go | 7 ++++++- services/webdav/cmd/webdav/main.go | 7 ++++++- services/webfinger/cmd/webfinger/main.go | 7 ++++++- 41 files changed, 246 insertions(+), 41 deletions(-) diff --git a/services/activitylog/cmd/activitylog/main.go b/services/activitylog/cmd/activitylog/main.go index d10204f4c..a8555bd20 100644 --- a/services/activitylog/cmd/activitylog/main.go +++ b/services/activitylog/cmd/activitylog/main.go @@ -1,14 +1,19 @@ package main import ( + "context" "os" + "os/signal" + "syscall" "github.com/owncloud/ocis/v2/services/activitylog/pkg/command" "github.com/owncloud/ocis/v2/services/activitylog/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) } } diff --git a/services/antivirus/cmd/antivirus/main.go b/services/antivirus/cmd/antivirus/main.go index b37a1ca3e..174e6fe3f 100644 --- a/services/antivirus/cmd/antivirus/main.go +++ b/services/antivirus/cmd/antivirus/main.go @@ -1,14 +1,19 @@ package main import ( + "context" "os" + "os/signal" + "syscall" "github.com/owncloud/ocis/v2/services/antivirus/pkg/command" "github.com/owncloud/ocis/v2/services/antivirus/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) } } diff --git a/services/app-provider/cmd/app-provider/main.go b/services/app-provider/cmd/app-provider/main.go index c4afd562c..42b66fd9c 100644 --- a/services/app-provider/cmd/app-provider/main.go +++ b/services/app-provider/cmd/app-provider/main.go @@ -1,14 +1,19 @@ package main import ( + "context" "os" + "os/signal" + "syscall" "github.com/owncloud/ocis/v2/services/app-provider/pkg/command" "github.com/owncloud/ocis/v2/services/app-provider/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) } } diff --git a/services/app-registry/cmd/app-registry/main.go b/services/app-registry/cmd/app-registry/main.go index 6a9d91f7d..e00af3f2a 100644 --- a/services/app-registry/cmd/app-registry/main.go +++ b/services/app-registry/cmd/app-registry/main.go @@ -1,14 +1,19 @@ package main import ( + "context" "os" + "os/signal" + "syscall" "github.com/owncloud/ocis/v2/services/app-registry/pkg/command" "github.com/owncloud/ocis/v2/services/app-registry/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) } } diff --git a/services/audit/cmd/audit/main.go b/services/audit/cmd/audit/main.go index f365e874e..8b33880d6 100644 --- a/services/audit/cmd/audit/main.go +++ b/services/audit/cmd/audit/main.go @@ -1,14 +1,19 @@ package main import ( + "context" "os" + "os/signal" + "syscall" "github.com/owncloud/ocis/v2/services/audit/pkg/command" "github.com/owncloud/ocis/v2/services/audit/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) } } diff --git a/services/auth-app/cmd/auth-app/main.go b/services/auth-app/cmd/auth-app/main.go index 185d6eb9f..d6cdb39e0 100644 --- a/services/auth-app/cmd/auth-app/main.go +++ b/services/auth-app/cmd/auth-app/main.go @@ -1,14 +1,19 @@ package main import ( + "context" "os" + "os/signal" + "syscall" "github.com/owncloud/ocis/v2/services/auth-app/pkg/command" "github.com/owncloud/ocis/v2/services/auth-app/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) } } diff --git a/services/auth-basic/cmd/auth-basic/main.go b/services/auth-basic/cmd/auth-basic/main.go index ec5af41ed..784d715be 100644 --- a/services/auth-basic/cmd/auth-basic/main.go +++ b/services/auth-basic/cmd/auth-basic/main.go @@ -1,14 +1,19 @@ package main import ( + "context" "os" + "os/signal" + "syscall" "github.com/owncloud/ocis/v2/services/auth-basic/pkg/command" "github.com/owncloud/ocis/v2/services/auth-basic/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) } } diff --git a/services/auth-bearer/cmd/auth-bearer/main.go b/services/auth-bearer/cmd/auth-bearer/main.go index 8617701cf..4bc12ab09 100644 --- a/services/auth-bearer/cmd/auth-bearer/main.go +++ b/services/auth-bearer/cmd/auth-bearer/main.go @@ -1,14 +1,19 @@ package main import ( + "context" "os" + "os/signal" + "syscall" "github.com/owncloud/ocis/v2/services/auth-bearer/pkg/command" "github.com/owncloud/ocis/v2/services/auth-bearer/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) } } diff --git a/services/auth-machine/cmd/auth-machine/main.go b/services/auth-machine/cmd/auth-machine/main.go index 937b0b20c..aeb79d5cc 100644 --- a/services/auth-machine/cmd/auth-machine/main.go +++ b/services/auth-machine/cmd/auth-machine/main.go @@ -1,14 +1,19 @@ package main import ( + "context" "os" + "os/signal" + "syscall" "github.com/owncloud/ocis/v2/services/auth-machine/pkg/command" "github.com/owncloud/ocis/v2/services/auth-machine/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) } } diff --git a/services/auth-service/cmd/auth-service/main.go b/services/auth-service/cmd/auth-service/main.go index bcc7a625e..81ce1579e 100644 --- a/services/auth-service/cmd/auth-service/main.go +++ b/services/auth-service/cmd/auth-service/main.go @@ -1,14 +1,19 @@ package main import ( + "context" "os" + "os/signal" + "syscall" "github.com/owncloud/ocis/v2/services/auth-service/pkg/command" "github.com/owncloud/ocis/v2/services/auth-service/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) } } diff --git a/services/clientlog/cmd/clientlog/main.go b/services/clientlog/cmd/clientlog/main.go index ce0d4a4af..cdd91f273 100644 --- a/services/clientlog/cmd/clientlog/main.go +++ b/services/clientlog/cmd/clientlog/main.go @@ -1,14 +1,19 @@ package main import ( + "context" "os" + "os/signal" + "syscall" "github.com/owncloud/ocis/v2/services/clientlog/pkg/command" "github.com/owncloud/ocis/v2/services/clientlog/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) } } diff --git a/services/eventhistory/cmd/eventhistory/main.go b/services/eventhistory/cmd/eventhistory/main.go index d2172949b..4a1d3f870 100644 --- a/services/eventhistory/cmd/eventhistory/main.go +++ b/services/eventhistory/cmd/eventhistory/main.go @@ -1,14 +1,19 @@ package main import ( + "context" "os" + "os/signal" + "syscall" "github.com/owncloud/ocis/v2/services/eventhistory/pkg/command" "github.com/owncloud/ocis/v2/services/eventhistory/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) } } diff --git a/services/frontend/cmd/frontend/main.go b/services/frontend/cmd/frontend/main.go index cbdc5dac5..8e12e7761 100644 --- a/services/frontend/cmd/frontend/main.go +++ b/services/frontend/cmd/frontend/main.go @@ -1,14 +1,19 @@ package main import ( + "context" "os" + "os/signal" + "syscall" "github.com/owncloud/ocis/v2/services/frontend/pkg/command" "github.com/owncloud/ocis/v2/services/frontend/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) } } diff --git a/services/graph/cmd/graph/main.go b/services/graph/cmd/graph/main.go index 7844daa6a..0775fcb48 100644 --- a/services/graph/cmd/graph/main.go +++ b/services/graph/cmd/graph/main.go @@ -1,14 +1,19 @@ package main import ( + "context" "os" + "os/signal" + "syscall" "github.com/owncloud/ocis/v2/services/graph/pkg/command" "github.com/owncloud/ocis/v2/services/graph/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) } } diff --git a/services/groups/cmd/groups/main.go b/services/groups/cmd/groups/main.go index 2172fc845..d13447d49 100644 --- a/services/groups/cmd/groups/main.go +++ b/services/groups/cmd/groups/main.go @@ -1,14 +1,19 @@ package main import ( + "context" "os" + "os/signal" + "syscall" "github.com/owncloud/ocis/v2/services/groups/pkg/command" "github.com/owncloud/ocis/v2/services/groups/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) } } diff --git a/services/idm/cmd/idm/main.go b/services/idm/cmd/idm/main.go index f30202e58..ab6af89f2 100644 --- a/services/idm/cmd/idm/main.go +++ b/services/idm/cmd/idm/main.go @@ -1,14 +1,19 @@ package main import ( + "context" "os" + "os/signal" + "syscall" "github.com/owncloud/ocis/v2/services/idm/pkg/command" "github.com/owncloud/ocis/v2/services/idm/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) } } diff --git a/services/idp/cmd/idp/main.go b/services/idp/cmd/idp/main.go index 174283c90..d3def5ab1 100644 --- a/services/idp/cmd/idp/main.go +++ b/services/idp/cmd/idp/main.go @@ -1,14 +1,19 @@ package main import ( + "context" "os" + "os/signal" + "syscall" "github.com/owncloud/ocis/v2/services/idp/pkg/command" "github.com/owncloud/ocis/v2/services/idp/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) } } diff --git a/services/invitations/cmd/invitations/main.go b/services/invitations/cmd/invitations/main.go index 3290c0b30..86da31fcb 100644 --- a/services/invitations/cmd/invitations/main.go +++ b/services/invitations/cmd/invitations/main.go @@ -1,14 +1,19 @@ package main import ( + "context" "os" + "os/signal" + "syscall" "github.com/owncloud/ocis/v2/services/invitations/pkg/command" "github.com/owncloud/ocis/v2/services/invitations/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) } } diff --git a/services/nats/cmd/nats/main.go b/services/nats/cmd/nats/main.go index 4b5803ac7..2e75edad3 100644 --- a/services/nats/cmd/nats/main.go +++ b/services/nats/cmd/nats/main.go @@ -1,14 +1,19 @@ package main import ( + "context" "os" + "os/signal" + "syscall" "github.com/owncloud/ocis/v2/services/nats/pkg/command" "github.com/owncloud/ocis/v2/services/nats/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) } } diff --git a/services/notifications/cmd/notifications/main.go b/services/notifications/cmd/notifications/main.go index 5d5752af3..1836a24f8 100644 --- a/services/notifications/cmd/notifications/main.go +++ b/services/notifications/cmd/notifications/main.go @@ -1,14 +1,19 @@ package main import ( + "context" "os" + "os/signal" + "syscall" "github.com/owncloud/ocis/v2/services/notifications/pkg/command" "github.com/owncloud/ocis/v2/services/notifications/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) } } diff --git a/services/ocdav/cmd/ocdav/main.go b/services/ocdav/cmd/ocdav/main.go index 9875027bd..964af1667 100644 --- a/services/ocdav/cmd/ocdav/main.go +++ b/services/ocdav/cmd/ocdav/main.go @@ -1,14 +1,19 @@ package main import ( + "context" "os" + "os/signal" + "syscall" "github.com/owncloud/ocis/v2/services/ocdav/pkg/command" "github.com/owncloud/ocis/v2/services/ocdav/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) } } diff --git a/services/ocm/cmd/ocm/main.go b/services/ocm/cmd/ocm/main.go index 6ac3d5a57..6a4b7926d 100644 --- a/services/ocm/cmd/ocm/main.go +++ b/services/ocm/cmd/ocm/main.go @@ -1,14 +1,19 @@ package main import ( + "context" "os" + "os/signal" + "syscall" "github.com/owncloud/ocis/v2/services/ocm/pkg/command" "github.com/owncloud/ocis/v2/services/ocm/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) } } diff --git a/services/ocs/cmd/ocs/main.go b/services/ocs/cmd/ocs/main.go index a2b9021ea..8ae7d0262 100644 --- a/services/ocs/cmd/ocs/main.go +++ b/services/ocs/cmd/ocs/main.go @@ -1,14 +1,19 @@ package main import ( + "context" "os" + "os/signal" + "syscall" "github.com/owncloud/ocis/v2/services/ocs/pkg/command" "github.com/owncloud/ocis/v2/services/ocs/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) } } diff --git a/services/policies/cmd/policies/main.go b/services/policies/cmd/policies/main.go index db0896e40..09abb5e85 100644 --- a/services/policies/cmd/policies/main.go +++ b/services/policies/cmd/policies/main.go @@ -1,14 +1,19 @@ package main import ( + "context" "os" + "os/signal" + "syscall" "github.com/owncloud/ocis/v2/services/policies/pkg/command" "github.com/owncloud/ocis/v2/services/policies/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) } } diff --git a/services/postprocessing/cmd/postprocessing/main.go b/services/postprocessing/cmd/postprocessing/main.go index ddc191e3a..e42d50ccd 100644 --- a/services/postprocessing/cmd/postprocessing/main.go +++ b/services/postprocessing/cmd/postprocessing/main.go @@ -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) } } diff --git a/services/proxy/cmd/proxy/main.go b/services/proxy/cmd/proxy/main.go index 7db75b5de..9c51a443e 100644 --- a/services/proxy/cmd/proxy/main.go +++ b/services/proxy/cmd/proxy/main.go @@ -1,14 +1,19 @@ package main import ( + "context" "os" + "os/signal" + "syscall" "github.com/owncloud/ocis/v2/services/proxy/pkg/command" "github.com/owncloud/ocis/v2/services/proxy/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) } } diff --git a/services/search/cmd/search/main.go b/services/search/cmd/search/main.go index 70103e7bf..807b66427 100644 --- a/services/search/cmd/search/main.go +++ b/services/search/cmd/search/main.go @@ -1,14 +1,19 @@ package main import ( + "context" "os" + "os/signal" + "syscall" "github.com/owncloud/ocis/v2/services/search/pkg/command" "github.com/owncloud/ocis/v2/services/search/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) } } diff --git a/services/settings/cmd/settings/main.go b/services/settings/cmd/settings/main.go index 1e21338dd..8833af4bb 100644 --- a/services/settings/cmd/settings/main.go +++ b/services/settings/cmd/settings/main.go @@ -1,14 +1,19 @@ package main import ( + "context" "os" + "os/signal" + "syscall" "github.com/owncloud/ocis/v2/services/settings/pkg/command" "github.com/owncloud/ocis/v2/services/settings/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) } } diff --git a/services/sharing/cmd/sharing/main.go b/services/sharing/cmd/sharing/main.go index 54e0996e3..cb5b4e5cc 100644 --- a/services/sharing/cmd/sharing/main.go +++ b/services/sharing/cmd/sharing/main.go @@ -1,14 +1,19 @@ package main import ( + "context" "os" + "os/signal" + "syscall" "github.com/owncloud/ocis/v2/services/sharing/pkg/command" "github.com/owncloud/ocis/v2/services/sharing/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) } } diff --git a/services/sse/cmd/sse/main.go b/services/sse/cmd/sse/main.go index 8bd438f11..9b31eea52 100644 --- a/services/sse/cmd/sse/main.go +++ b/services/sse/cmd/sse/main.go @@ -1,14 +1,19 @@ package main import ( + "context" "os" + "os/signal" + "syscall" "github.com/owncloud/ocis/v2/services/sse/pkg/command" "github.com/owncloud/ocis/v2/services/sse/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) } } diff --git a/services/storage-publiclink/cmd/storage-publiclink/main.go b/services/storage-publiclink/cmd/storage-publiclink/main.go index 6d2415a00..e1637605c 100644 --- a/services/storage-publiclink/cmd/storage-publiclink/main.go +++ b/services/storage-publiclink/cmd/storage-publiclink/main.go @@ -1,14 +1,19 @@ package main import ( + "context" "os" + "os/signal" + "syscall" "github.com/owncloud/ocis/v2/services/storage-publiclink/pkg/command" "github.com/owncloud/ocis/v2/services/storage-publiclink/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) } } diff --git a/services/storage-shares/cmd/storage-shares/main.go b/services/storage-shares/cmd/storage-shares/main.go index 8a8f9336b..472cf04c8 100644 --- a/services/storage-shares/cmd/storage-shares/main.go +++ b/services/storage-shares/cmd/storage-shares/main.go @@ -1,14 +1,19 @@ package main import ( + "context" "os" + "os/signal" + "syscall" "github.com/owncloud/ocis/v2/services/storage-shares/pkg/command" "github.com/owncloud/ocis/v2/services/storage-shares/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) } } diff --git a/services/storage-system/cmd/storage-system/main.go b/services/storage-system/cmd/storage-system/main.go index d9242ea05..761e1ab23 100644 --- a/services/storage-system/cmd/storage-system/main.go +++ b/services/storage-system/cmd/storage-system/main.go @@ -1,14 +1,19 @@ package main import ( + "context" "os" + "os/signal" + "syscall" "github.com/owncloud/ocis/v2/services/storage-system/pkg/command" "github.com/owncloud/ocis/v2/services/storage-system/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) } } diff --git a/services/storage-users/cmd/storage-users/main.go b/services/storage-users/cmd/storage-users/main.go index c3c7bc7e3..142e5a441 100644 --- a/services/storage-users/cmd/storage-users/main.go +++ b/services/storage-users/cmd/storage-users/main.go @@ -1,14 +1,19 @@ package main import ( + "context" "os" + "os/signal" + "syscall" "github.com/owncloud/ocis/v2/services/storage-users/pkg/command" "github.com/owncloud/ocis/v2/services/storage-users/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) } } diff --git a/services/store/cmd/store/main.go b/services/store/cmd/store/main.go index ecf42e819..3bbf8cff8 100644 --- a/services/store/cmd/store/main.go +++ b/services/store/cmd/store/main.go @@ -1,14 +1,19 @@ package main import ( + "context" "os" + "os/signal" + "syscall" "github.com/owncloud/ocis/v2/services/store/pkg/command" "github.com/owncloud/ocis/v2/services/store/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) } } diff --git a/services/thumbnails/cmd/thumbnails/main.go b/services/thumbnails/cmd/thumbnails/main.go index f0a86f58b..9f3cce956 100644 --- a/services/thumbnails/cmd/thumbnails/main.go +++ b/services/thumbnails/cmd/thumbnails/main.go @@ -1,14 +1,19 @@ package main import ( + "context" "os" + "os/signal" + "syscall" "github.com/owncloud/ocis/v2/services/thumbnails/pkg/command" "github.com/owncloud/ocis/v2/services/thumbnails/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) } } diff --git a/services/userlog/cmd/userlog/main.go b/services/userlog/cmd/userlog/main.go index efdb7ae4b..2df9a2a98 100644 --- a/services/userlog/cmd/userlog/main.go +++ b/services/userlog/cmd/userlog/main.go @@ -1,14 +1,19 @@ package main import ( + "context" "os" + "os/signal" + "syscall" "github.com/owncloud/ocis/v2/services/userlog/pkg/command" "github.com/owncloud/ocis/v2/services/userlog/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) } } diff --git a/services/users/cmd/user/main.go b/services/users/cmd/user/main.go index cae358d3c..6d6928932 100644 --- a/services/users/cmd/user/main.go +++ b/services/users/cmd/user/main.go @@ -1,14 +1,19 @@ package main import ( + "context" "os" + "os/signal" + "syscall" "github.com/owncloud/ocis/v2/services/users/pkg/command" "github.com/owncloud/ocis/v2/services/users/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) } } diff --git a/services/web/cmd/web/main.go b/services/web/cmd/web/main.go index 9974c37fc..2ee45f9ee 100644 --- a/services/web/cmd/web/main.go +++ b/services/web/cmd/web/main.go @@ -1,14 +1,19 @@ package main import ( + "context" "os" + "os/signal" + "syscall" "github.com/owncloud/ocis/v2/services/web/pkg/command" "github.com/owncloud/ocis/v2/services/web/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) } } diff --git a/services/webdav/cmd/webdav/main.go b/services/webdav/cmd/webdav/main.go index 84449ec2e..08d0bdbbe 100644 --- a/services/webdav/cmd/webdav/main.go +++ b/services/webdav/cmd/webdav/main.go @@ -1,14 +1,19 @@ package main import ( + "context" "os" + "os/signal" + "syscall" "github.com/owncloud/ocis/v2/services/webdav/pkg/command" "github.com/owncloud/ocis/v2/services/webdav/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) } } diff --git a/services/webfinger/cmd/webfinger/main.go b/services/webfinger/cmd/webfinger/main.go index f370d1c9e..b67f9ba63 100644 --- a/services/webfinger/cmd/webfinger/main.go +++ b/services/webfinger/cmd/webfinger/main.go @@ -1,14 +1,19 @@ package main import ( + "context" "os" + "os/signal" + "syscall" "github.com/owncloud/ocis/v2/services/webfinger/pkg/command" "github.com/owncloud/ocis/v2/services/webfinger/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) } }