2019-01-16 04:19:11 +01:00
|
|
|
package main
|
|
|
|
|
2019-01-16 05:48:01 +01:00
|
|
|
import (
|
|
|
|
"log"
|
2020-05-06 01:49:46 +02:00
|
|
|
"os"
|
|
|
|
"os/signal"
|
|
|
|
"syscall"
|
2019-01-16 05:48:01 +01:00
|
|
|
|
2020-05-06 01:49:46 +02:00
|
|
|
"git.icod.de/dalu/contentplatform/core"
|
2019-01-16 05:48:01 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
var registry = NewPluginRegistry()
|
|
|
|
|
2019-01-16 04:19:11 +01:00
|
|
|
func main() {
|
2020-05-06 01:49:46 +02:00
|
|
|
catchSignal()
|
|
|
|
corePlugin := new(core.Core)
|
|
|
|
if e := registry.RegisterCorePlugin(corePlugin); e != nil {
|
|
|
|
log.Fatal(e.Error())
|
|
|
|
}
|
|
|
|
if e := registry.Run(); e != nil {
|
2019-01-16 05:48:01 +01:00
|
|
|
log.Fatal(e.Error())
|
|
|
|
}
|
2020-05-06 01:49:46 +02:00
|
|
|
}
|
2019-01-16 05:48:01 +01:00
|
|
|
|
2020-05-06 01:49:46 +02:00
|
|
|
func catchSignal() {
|
|
|
|
sigc := make(chan os.Signal, 1)
|
|
|
|
signal.Notify(sigc, os.Interrupt, os.Kill, syscall.SIGTERM)
|
|
|
|
go func(c chan os.Signal) {
|
|
|
|
sig := <-c
|
|
|
|
log.Printf("Caught signal %s: shutting down.", sig)
|
|
|
|
registry.Shutdown()
|
|
|
|
os.Exit(0)
|
|
|
|
}(sigc)
|
2019-01-16 04:19:11 +01:00
|
|
|
}
|