-
Notifications
You must be signed in to change notification settings - Fork 74
Expand file tree
/
Copy pathwire.go
More file actions
58 lines (54 loc) · 1.32 KB
/
wire.go
File metadata and controls
58 lines (54 loc) · 1.32 KB
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
49
50
51
52
53
54
55
56
57
58
//go:build wireinject
// +build wireinject
package main
import (
"context"
"go-drive/common"
"go-drive/common/event"
"go-drive/common/i18n"
"go-drive/common/registry"
"go-drive/common/task"
"go-drive/common/types"
"go-drive/common/utils"
"go-drive/drive"
"go-drive/server"
"go-drive/server/job"
"go-drive/server/search"
"go-drive/server/thumbnail"
"go-drive/storage"
"github.com/gin-gonic/gin"
"github.com/google/wire"
)
func Initialize(ctx context.Context, ch *registry.ComponentsHolder) (*gin.Engine, error) {
wire.Build(
common.InitConfig,
storage.NewDB,
event.NewBus,
storage.NewUserDAO,
storage.NewPathPermissionDAO,
storage.NewDriveCacheDAO,
storage.NewGroupDAO,
storage.NewPathMountDAO,
storage.NewDriveDAO,
storage.NewDriveDataDAO,
storage.NewOptionsDAO,
storage.NewJobDAO,
storage.NewPathMetaDAO,
storage.NewFileBucketDAO,
wire.Bind(new(task.Runner), new(*task.TunnyRunner)),
task.NewTunnyRunner,
utils.NewSigner,
wire.Bind(new(types.TokenStore), new(*server.FileTokenStore)),
server.NewFileTokenStore,
server.NewChunkUploader,
thumbnail.NewMaker,
drive.NewRootDrive,
drive.NewAccess,
search.NewService,
wire.Bind(new(i18n.MessageSource), new(*i18n.FileMessageSource)),
i18n.NewFileMessageSource,
job.NewJobExecutor,
server.InitServer,
)
return &gin.Engine{}, nil
}