2019-11-16 16:03:28 +00:00
|
|
|
//go:generate go run -mod=vendor github.com/99designs/gqlgen
|
2019-02-09 12:30:49 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2021-05-16 07:21:11 +00:00
|
|
|
"os"
|
|
|
|
"os/signal"
|
|
|
|
"runtime/pprof"
|
|
|
|
"syscall"
|
|
|
|
|
2019-02-14 23:42:52 +00:00
|
|
|
"github.com/stashapp/stash/pkg/api"
|
|
|
|
"github.com/stashapp/stash/pkg/manager"
|
2019-02-09 12:30:49 +00:00
|
|
|
|
|
|
|
_ "github.com/golang-migrate/migrate/v4/database/sqlite3"
|
|
|
|
_ "github.com/golang-migrate/migrate/v4/source/file"
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
2019-03-23 14:56:59 +00:00
|
|
|
manager.Initialize()
|
2019-02-09 12:30:49 +00:00
|
|
|
api.Start()
|
2021-05-16 07:21:11 +00:00
|
|
|
|
|
|
|
// stop any profiling at exit
|
|
|
|
defer pprof.StopCPUProfile()
|
2019-02-11 10:49:39 +00:00
|
|
|
blockForever()
|
|
|
|
}
|
|
|
|
|
|
|
|
func blockForever() {
|
2021-05-16 07:21:11 +00:00
|
|
|
// handle signals
|
|
|
|
signals := make(chan os.Signal, 1)
|
|
|
|
signal.Notify(signals, syscall.SIGINT, syscall.SIGTERM)
|
|
|
|
|
|
|
|
<-signals
|
2019-02-09 12:30:49 +00:00
|
|
|
}
|