-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
40 lines (29 loc) · 767 Bytes
/
main.go
File metadata and controls
40 lines (29 loc) · 767 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package main
import (
"context"
"os"
"os/signal"
"sync"
"syscall"
"github.com/Ahu-Tools/example/config"
"github.com/Ahu-Tools/example/edge"
"github.com/Ahu-Tools/example/log"
)
func main() {
config.CheckConfigs()
if err := config.ConfigInfras(); err != nil {
log.Logger.Error("Infrastructures configuration failed.", "error", err)
os.Exit(1)
}
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
signalChan := make(chan os.Signal, 1)
signal.Notify(signalChan, syscall.SIGINT, syscall.SIGTERM)
var wg sync.WaitGroup
edge.Start(ctx, &wg)
<-signalChan
log.Logger.Info("Shutdown signal received. Shutting down edges gracefully...")
cancel()
wg.Wait()
log.Logger.Info("All edges have been shutted down. Exiting.")
}