add orbis demo
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2025-01-06 22:40:54 +01:00
parent ed2e15a3dd
commit fe02e0ac79
4 changed files with 51 additions and 3 deletions

View File

@@ -1,8 +1,12 @@
package main
import (
"context"
"fmt"
"os"
"os/signal"
"syscall"
"time"
"git.front.kjuulh.io/kjuulh/orbis/internal/app"
"github.com/joho/godotenv"
@@ -17,7 +21,23 @@ func main() {
app := app.NewApp()
if err := newRoot(app).Execute(); err != nil {
ctx, cancel := context.WithCancel(context.Background())
stop := make(chan os.Signal, 1)
signal.Notify(stop, os.Interrupt, syscall.SIGTERM)
go func() {
<-stop
app.Logger().Info("stop signal received: shutting down orbis")
cancel()
// Start timer for hard stop
time.Sleep(time.Second * 10)
fmt.Println("orbis failed to stop in time, forced to hard cancel")
os.Exit(1)
}()
if err := newRoot(app).ExecuteContext(ctx); err != nil {
fmt.Printf("%s\n", err)
os.Exit(1)
}