server

package
v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 26, 2026 License: Apache-2.0 Imports: 30 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package server wires the vx server together: database, blob store, git bridge, API handlers and the HTTP listener.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Addr        string // listen address, e.g. ":7070"
	DatabaseURL string
	DataDir     string // git mirrors, and the blob store unless BlobURL is set
	// BlobURL names the blob store (blob.Open): empty for the disk store in
	// DataDir/objects, or s3://BUCKET/PREFIX?... for object storage, with
	// credentials in VX_BLOB_ACCESS_KEY_ID and VX_BLOB_SECRET_ACCESS_KEY.
	BlobURL string
	// Blobs, when set, is used instead of opening BlobURL (tests).
	Blobs  blob.Store
	Logger *slog.Logger
	// Upstream imports branches from git providers; nil disables it.
	Upstream func(st *store.Store, blobs blob.Store, dataDir string) (service.UpstreamSyncer, error)
	// GitHub configures the GitHub App (VX_PUBLIC_URL, VX_SECRET_KEY,
	// VX_SIGNUP). Connect defaults to the internal/github client.
	GitHub service.GitHubSettings
	// Hosts configures GitLab, Gitea, Forgejo and Bitbucket webhooks
	// (VX_<HOST>_WEBHOOK_SECRET).
	Hosts service.HostSettings
	// MetricsToken turns on /metrics for callers with this bearer token
	// (VX_METRICS_TOKEN); empty: no /metrics.
	MetricsToken string
	// Limits are the rate limits (VX_RATE_*); nil: none.
	Limits ratelimit.Config
	// Quotas are the organization quotas' defaults (VX_QUOTA_*); the data
	// directory's disk is watched either way.
	Quotas service.QuotaSettings
	// Audit configures the operation log (VX_AUDIT_RETENTION).
	Audit service.AuditSettings
	// Agreement is the data processing agreement step (VX_REQUIRE_DPA,
	// VX_DPA_DIR); off by default.
	Agreement service.AgreementSettings
	// OrgDeletion is the grace period before a deleted organization is
	// purged (VX_ORG_DELETE_GRACE).
	OrgDeletion service.OrgDeletionSettings
}

Config is the server configuration.

type Server

type Server struct {
	Store   *store.Store
	Blobs   blob.Store
	Service *service.Service
	Handler http.Handler
	// contains filtered or unexported fields
}

Server is a running vx server.

func New

func New(ctx context.Context, cfg Config) (*Server, error)

New opens the database (applying migrations) and builds the handler.

func (*Server) Close

func (s *Server) Close()

Close releases the database.

func (*Server) ListenAndServe

func (s *Server) ListenAndServe(ctx context.Context, addr string) error

ListenAndServe serves until ctx is cancelled, then shuts down gracefully. It logs why it stopped: context.Cause(ctx), which names the signal when ctx comes from signal.NotifyContext.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL