sourcegraph/cmd/frontend/internal/executorqueue/init.go
William Bezuidenhout 1ae6cc6bfd
logger: update log lib and remove use of description (#57690)
* log: remove use of description paramter in Scoped

* temporarily point to sglog branch

* bazel configure + gazelle

* remove additional use of description param

* use latest versions of zoekt,log,mountinfo

* go.mod
2023-10-18 17:29:08 +02:00

48 lines
1.4 KiB
Go

package executorqueue
import (
"github.com/sourcegraph/log"
"github.com/sourcegraph/sourcegraph/internal/conf/confdefaults"
"github.com/sourcegraph/sourcegraph/internal/conf/conftypes"
"github.com/sourcegraph/sourcegraph/internal/conf/deploy"
"github.com/sourcegraph/sourcegraph/internal/database"
"github.com/sourcegraph/sourcegraph/internal/observation"
"github.com/sourcegraph/sourcegraph/cmd/frontend/enterprise"
)
// Init initializes the executor endpoints required for use with the executor service.
func Init(
observationCtx *observation.Context,
db database.DB,
conf conftypes.UnifiedWatchable,
enterpriseServices *enterprise.Services,
) error {
codeintelUploadHandler := enterpriseServices.NewCodeIntelUploadHandler(false)
batchesWorkspaceFileGetHandler := enterpriseServices.BatchesChangesFileGetHandler
batchesWorkspaceFileExistsHandler := enterpriseServices.BatchesChangesFileGetHandler
accessToken := func() string {
if deploy.IsSingleBinary() {
return confdefaults.AppInMemoryExecutorPassword
}
return conf.SiteConfig().ExecutorsAccessToken
}
logger := log.Scoped("executorqueue")
queueHandler := newExecutorQueuesHandler(
observationCtx,
db,
logger,
accessToken,
codeintelUploadHandler,
batchesWorkspaceFileGetHandler,
batchesWorkspaceFileExistsHandler,
)
enterpriseServices.NewExecutorProxyHandler = queueHandler
return nil
}