MCPcopy Create free account
hub / github.com/devld/go-drive / InitServer

Function InitServer

server/server.go:28–122  ·  view source on GitHub ↗
(config common.Config,
	ch *registry.ComponentsHolder,
	bus event.Bus,
	rootDrive *drive.RootDrive,
	driveAccess *drive.Access,
	searcher *search.Service,
	tokenStore types.TokenStore,
	thumbnail *thumbnail.Maker,
	signer *utils.Signer,
	chunkUploader *ChunkUploader,
	runner task.Runner,
	optionsDAO *storage.OptionsDAO,
	userDAO *storage.UserDAO,
	groupDAO *storage.GroupDAO,
	driveDAO *storage.DriveDAO,
	driveDataDAO *storage.DriveDataDAO,
	permissionDAO *storage.PathPermissionDAO,
	pathMountDAO *storage.PathMountDAO,
	pathMetaDAO *storage.PathMetaDAO,
	jobDAO *storage.JobDAO,
	fileBucketDAO *storage.FileBucketDAO,
	jobExecutor *job.JobExecutor,
	messageSource i18n.MessageSource,
	webFS fs.FS)

Source from the content-addressed store, hash-verified

26)
27
28func InitServer(config common.Config,
29 ch *registry.ComponentsHolder,
30 bus event.Bus,
31 rootDrive *drive.RootDrive,
32 driveAccess *drive.Access,
33 searcher *search.Service,
34 tokenStore types.TokenStore,
35 thumbnail *thumbnail.Maker,
36 signer *utils.Signer,
37 chunkUploader *ChunkUploader,
38 runner task.Runner,
39 optionsDAO *storage.OptionsDAO,
40 userDAO *storage.UserDAO,
41 groupDAO *storage.GroupDAO,
42 driveDAO *storage.DriveDAO,
43 driveDataDAO *storage.DriveDataDAO,
44 permissionDAO *storage.PathPermissionDAO,
45 pathMountDAO *storage.PathMountDAO,
46 pathMetaDAO *storage.PathMetaDAO,
47 jobDAO *storage.JobDAO,
48 fileBucketDAO *storage.FileBucketDAO,
49 jobExecutor *job.JobExecutor,
50 messageSource i18n.MessageSource,
51 webFS fs.FS) (*gin.Engine, error) {
52
53 if utils.IsDebugOn {
54 gin.SetMode(gin.DebugMode)
55 } else {
56 gin.SetMode(gin.ReleaseMode)
57 }
58
59 engine := gin.New()
60
61 if len(config.TrustedProxies) > 0 {
62 if e := engine.SetTrustedProxies(config.TrustedProxies); e != nil {
63 return nil, e
64 }
65 } else {
66 engine.SetTrustedProxies(nil)
67 }
68
69 engine.Use(gin.CustomRecovery(handlePanic))
70
71 if noLogRequest, _ := os.LookupEnv("NO_LOG_REQUEST"); noLogRequest == "" {
72 engine.Use(Logger())
73 }
74
75 engine.Use(apiResultHandler(messageSource))
76
77 userAuth, e := auth.NewUserAuth(config.Auth.Providers, ch)
78 if e != nil {
79 return nil, e
80 }
81 ch.Add(registry.KeyUserAuth, userAuth)
82
83 router := engine.Group(config.APIPath)
84
85 failBanGroup := NewFailBanGroup(10 * time.Minute)

Callers 1

InitializeFunction · 0.92

Calls 13

NewUserAuthFunction · 0.92
LoggerFunction · 0.85
apiResultHandlerFunction · 0.85
NewFailBanGroupFunction · 0.85
InitCommonRoutesFunction · 0.85
InitAuthRoutesFunction · 0.85
InitAdminRoutesFunction · 0.85
InitDriveRoutesFunction · 0.85
InitFileBucketRoutesFunction · 0.85
InitWebdavAccessFunction · 0.85
newWebFilesFunction · 0.85
AddMethod · 0.45

Tested by

no test coverage detected