mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 16:31:47 +00:00
support single-program execution Now, `sg start single-program` starts a single-binary local dev server. This is similar to Cody app, but instead of using a Tauri desktop app UI and limiting to only Cody-related functionality, it runs a full Sourcegraph instance and lets you access it through your web browser. It is useful for local dev because it's less resource-intensive and has faster recompile/relink times than `sg start` (which runs many processes).
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.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
|
|
}
|