Help us shape the future of Go! Take the 2026 Go Developer Survey

api

package
v1.4.5 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2026 License: MIT Imports: 60 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthUser

type AuthUser struct {
	ID       int64
	Username string
	Role     string
}

func GetAuthUser

func GetAuthUser(r *http.Request) *AuthUser

type DeployerAuditAdapter

type DeployerAuditAdapter struct {
	Rec *audit.Recorder
}

DeployerAuditAdapter converts deployer.DeployAuditEvent to audit.RecordReq and forwards it to the audit.Recorder. It is the concrete impl of deployer.AuditEmitter injected at startup so internal/deployer stays decoupled from internal/audit.

func (*DeployerAuditAdapter) RecordDeploy

type Server

type Server struct {
	// contains filtered or unexported fields
}

func NewServer

func NewServer(port int, st *store.Store, jwtMgr *auth.JWTManager, rl *auth.RateLimiter) *Server

func (*Server) EnqueueGitCommit

func (s *Server) EnqueueGitCommit(paths []string, reason string)

EnqueueGitCommit enqueues a commit for paths if gitsync is enabled. No-op when nil.

func (*Server) GitSyncPushing added in v1.4.5

func (s *Server) GitSyncPushing() bool

GitSyncPushing reports whether git sync is running and pushes changes. The audit recorder uses it to mark rows pending only when a push will stamp them. Lock-free, since audit rows may be recorded under gsMu.

func (*Server) Handler

func (s *Server) Handler() http.Handler

func (*Server) InitDBBackupSchedule

func (s *Server) InitDBBackupSchedule()

func (*Server) ListenAndServe

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

func (*Server) ReloadGitSync

func (s *Server) ReloadGitSync(ctx context.Context) (*gitsync.Status, error)

ReloadGitSync stops the current syncer (if any), rebuilds config from DB+YAML, and starts a new syncer. Returns the new status or an error.

func (*Server) SetAppsDir

func (s *Server) SetAppsDir(dir string)

func (*Server) SetAudit

func (s *Server) SetAudit(a *audit.Recorder)

SetAudit sets the audit recorder.

func (*Server) SetBackupScheduler

func (s *Server) SetBackupScheduler(sched *backup.Scheduler)

SetBackupScheduler sets the backup scheduler (can be nil).

func (*Server) SetBindAddr

func (s *Server) SetBindAddr(addr string)

SetBindAddr sets the listener bind address (default "" = all interfaces). Use "127.0.0.1" to keep the dashboard local-only when not fronted by Caddy.

func (*Server) SetBuildInfo

func (s *Server) SetBuildInfo(version, commit, date string)

SetBuildInfo sets the build version, commit, and date.

func (*Server) SetBus

func (s *Server) SetBus(b *events.Bus)

SetBus wires the realtime events bus. nil disables /api/events.

func (*Server) SetConfig

func (s *Server) SetConfig(cfg *config.Config, path string)

SetConfig sets the active config and the path it was loaded from, enabling system settings endpoints to persist changes back to disk.

func (*Server) SetConfigSync

func (s *Server) SetConfigSync(cs *configsync.Syncer)

SetConfigSync sets the configsync.Syncer (nil disables sidecar cleanup on delete).

func (*Server) SetDBPath

func (s *Server) SetDBPath(path string)

SetDBPath sets the path to the SQLite database file.

func (*Server) SetDataDir

func (s *Server) SetDataDir(dir string)

func (*Server) SetDocker

func (s *Server) SetDocker(dc docker.Client)

SetDocker sets the docker client.

func (*Server) SetGitSync

func (s *Server) SetGitSync(gs *gitsync.Syncer)

SetGitSync sets the gitsync.Syncer (nil disables git endpoints).

func (*Server) SetLockout

func (s *Server) SetLockout(l *auth.LoginLockout)

SetLockout sets the login lockout tracker.

func (*Server) SetLogBuffer

func (s *Server) SetLogBuffer(lb *logbuf.Buffer)

SetLogBuffer sets the log buffer for system log streaming.

func (*Server) SetLoginLimiter

func (s *Server) SetLoginLimiter(rl *auth.RateLimiter)

SetLoginLimiter installs a dedicated rate limiter for the login endpoint so login abuse cannot deplete the global request budget.

func (*Server) SetMasterSecret

func (s *Server) SetMasterSecret(secret string)

SetMasterSecret sets the master secret for encrypting registry credentials.

func (*Server) SetProxyReloader added in v1.4.1

func (s *Server) SetProxyReloader(p proxyReloader)

SetProxyReloader sets the proxy used to apply cert changes.

func (*Server) SetRecipesCache

func (s *Server) SetRecipesCache(c *recipes.Cache)

SetRecipesCache enables /api/recipes/community endpoints. nil disables them.

func (*Server) SetReconciler

func (s *Server) SetReconciler(rec reconciler)

func (*Server) SetReconcilerRef

func (s *Server) SetReconcilerRef(r gitsync.Reconciler)

SetReconcilerRef sets the reconciler callback used when reloading gitsync.

func (*Server) SetReservedDomains added in v1.4.3

func (s *Server) SetReservedDomains(domains ...string)

SetReservedDomains marks domains app endpoints may not use, e.g. the dashboard's config `domain`. Empty entries are ignored.

func (*Server) SetTLSMode

func (s *Server) SetTLSMode(mode string)

func (*Server) SetTrustedProxies

func (s *Server) SetTrustedProxies(proxies []string)

SetTrustedProxies sets the trusted proxy IPs for X-Forwarded-For parsing.

func (*Server) SetUIFS

func (s *Server) SetUIFS(fsys fs.FS)

SetUIFS serves the embedded SPA with fallback to index.html.

func (*Server) SetWebhookDispatcher

func (s *Server) SetWebhookDispatcher(d *alerts.WebhookDispatcher)

SetWebhookDispatcher sets the webhook dispatcher for test webhook functionality.

Jump to

Keyboard shortcuts

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