35 lines
609 B
Go
35 lines
609 B
Go
package main
|
|
|
|
import (
|
|
"log"
|
|
"os"
|
|
"os/signal"
|
|
"syscall"
|
|
|
|
"git.icod.de/dalu/contentplatform/core"
|
|
)
|
|
|
|
var registry = NewPluginRegistry()
|
|
|
|
func main() {
|
|
catchSignal()
|
|
corePlugin := new(core.Core)
|
|
if e := registry.RegisterCorePlugin(corePlugin); e != nil {
|
|
log.Fatal(e.Error())
|
|
}
|
|
if e := registry.Run(); e != nil {
|
|
log.Fatal(e.Error())
|
|
}
|
|
}
|
|
|
|
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)
|
|
}
|