ce7cb702218693d08ea6d83464d2457c9250027c
This commit is contained in:
commit
34c5f8963c
1 changed files with 145336 additions and 0 deletions
31
services/stalwart/cmd/controller/main.go
Normal file
31
services/stalwart/cmd/controller/main.go
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
"os/signal"
|
||||
"syscall"
|
||||
"time"
|
||||
)
|
||||
|
||||
func runMain(ctx context.Context, arguments []string) error {
|
||||
if len(arguments) == 2 && arguments[0] == "wait-oidc" {
|
||||
return waitForOIDC(ctx, arguments[1], 2*time.Second)
|
||||
}
|
||||
value, err := parseOptions(arguments)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return runController(ctx, value)
|
||||
}
|
||||
|
||||
func main() {
|
||||
ctx, stop := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM)
|
||||
err := runMain(ctx, os.Args[1:])
|
||||
stop()
|
||||
if err != nil {
|
||||
fmt.Fprintln(os.Stderr, "controller stopped:", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue