mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 19:21:50 +00:00
Context: I am working towards us having two definitions in our codebase: 1. "App" -> the _deployment type_ of Sourcegraph you use on your local machine. 2. "Single binary" -> App is always single-binary, but not all single-binaries are App. In the future, all Sourcegraph services will be "single binary" and so this term will exist in our codebase to refer to code that is used when ran in a "single binary" setting. --- Stacked on top of #49064 This change introduces `deploy.IsApp()` and `deploy.IsSingleBinary()` helpers that do not need to be fed the deployment type. ## Test plan Existing tests Signed-off-by: Stephen Gutekanst <stephen@sourcegraph.com>
48 lines
1.4 KiB
Go
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.IsApp() {
|
|
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
|
|
}
|