-
-
Notifications
You must be signed in to change notification settings - Fork 66
/
Copy pathmain.go
48 lines (38 loc) · 1.09 KB
/
main.go
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
41
42
43
44
45
46
47
48
//go:generate go run github.com/99designs/gqlgen
package main
import (
"context"
"embed"
"github.com/stashapp/stash-box/pkg/api"
"github.com/stashapp/stash-box/pkg/database"
"github.com/stashapp/stash-box/pkg/image"
"github.com/stashapp/stash-box/pkg/logger"
"github.com/stashapp/stash-box/pkg/manager"
"github.com/stashapp/stash-box/pkg/manager/config"
"github.com/stashapp/stash-box/pkg/manager/cron"
"github.com/stashapp/stash-box/pkg/manager/notifications"
"github.com/stashapp/stash-box/pkg/sqlx"
"github.com/stashapp/stash-box/pkg/user"
)
//go:embed frontend/build
var ui embed.FS
func main() {
manager.Initialize()
cleanup := logger.InitTracer()
//nolint:errcheck
defer cleanup(context.Background())
api.InitializeSession()
const databaseProvider = "postgres"
db := database.Initialize(databaseProvider, config.GetDatabasePath())
txnMgr := sqlx.NewTxnMgr(db)
user.CreateSystemUsers(txnMgr.Repo(context.Background()))
api.Start(txnMgr, ui)
cron.Init(txnMgr)
notifications.Init(txnMgr)
image.InitResizer()
blockForever()
}
func blockForever() {
c := make(chan struct{})
<-c
}