services

package
v5.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2026 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ForgeConfig added in v5.2.0

type ForgeConfig struct {
	Name              string
	Type              model.ForgeType
	URL               string
	Client            string
	ClientSecret      string
	SkipVerify        bool
	OAuthHost         string
	Icon              string // custom icon name (e.g., "codeberg", "github") or URL to custom icon
	AdditionalOptions map[string]any
}

ForgeConfig represents the configuration for a single forge parsed from environment variables.

func ParseMultiForgeConfig added in v5.2.0

func ParseMultiForgeConfig() ([]ForgeConfig, error)

ParseMultiForgeConfig parses multi-forge configuration from environment variables. It expects CROW_FORGES to contain a comma-separated list of forge names, and then for each forge name, it reads CROW_FORGE_{NAME}_TYPE, CROW_FORGE_{NAME}_URL, etc.

Example:

CROW_FORGES=codeberg,github
CROW_FORGE_CODEBERG_TYPE=forgejo
CROW_FORGE_CODEBERG_URL=https://codeberg.org
CROW_FORGE_CODEBERG_CLIENT=xxx
CROW_FORGE_CODEBERG_SECRET=yyy
CROW_FORGE_GITHUB_TYPE=github
CROW_FORGE_GITHUB_URL=https://github.com
CROW_FORGE_GITHUB_CLIENT=aaa
CROW_FORGE_GITHUB_SECRET=bbb

type MaintenanceScheduler

type MaintenanceScheduler interface {
	// Start begins the maintenance scheduler
	Start() error
	// Stop stops the maintenance scheduler
	Stop()
	// UpdateSchedule updates the maintenance schedule
	UpdateSchedule(schedule string, enabled bool) error
	// RunManual runs maintenance manually (outside of schedule)
	RunManual() error
}

MaintenanceScheduler defines the interface for maintenance scheduling.

type MaintenanceService

type MaintenanceService interface {
	// RunMaintenance executes database maintenance operations
	RunMaintenance(ctx context.Context) error
	// RunKubernetesCleanup executes Kubernetes resource cleanup
	RunKubernetesCleanup(ctx context.Context, dryRun bool) error
	// RunStaleAgentCleanup executes stale agent cleanup
	RunStaleAgentCleanup(ctx context.Context, staleDuration time.Duration) error
	// GetMaintenanceConfig returns the current maintenance configuration
	GetMaintenanceConfig() *model.MaintenanceConfig
	// UpdateMaintenanceConfig updates the maintenance configuration
	UpdateMaintenanceConfig(config *model.MaintenanceConfig) error
	// GetMaintenanceConfigByAction returns config for a specific action type
	GetMaintenanceConfigByAction(actionType string) (*model.MaintenanceConfig, error)
	// UpdateMaintenanceConfigByAction updates config for a specific action type
	UpdateMaintenanceConfigByAction(actionType string, config *model.MaintenanceConfig) error
	// IsKubernetesCleanupAvailable returns whether Kubernetes cleanup is available
	IsKubernetesCleanupAvailable() bool
	// GetMaintenanceStats returns maintenance statistics
	GetMaintenanceStats() (*model.MaintenanceStats, error)
	// SetKubernetesCleanupFunc sets the function to use for Kubernetes cleanup
	SetKubernetesCleanupFunc(f func(ctx context.Context, dryRun bool) error)
	// SetKubernetesCleanupEnabled sets whether Kubernetes cleanup is enabled for execution
	SetKubernetesCleanupEnabled(enabled bool)
	// SetVacuumEnvVarsConfigured sets whether vacuum-specific environment variables are overriding configuration
	SetVacuumEnvVarsConfigured(vacuumEnvVarsSet bool)
	// IsVacuumEnvVarsConfigured returns whether vacuum-specific environment variables are set
	IsVacuumEnvVarsConfigured() bool
	// SetKubernetesEnvVarsConfigured sets whether Kubernetes-specific environment variables are set
	SetKubernetesEnvVarsConfigured(k8sEnvVarsSet bool)
	// IsKubernetesEnvVarsConfigured returns whether Kubernetes-specific environment variables are set
	IsKubernetesEnvVarsConfigured() bool
}

MaintenanceService defines the interface for database maintenance operations.

type Manager

type Manager interface {
	SignaturePublicKey() crypto.PublicKey
	SecretServiceFromRepo(repo *model.Repo) secret.Service
	SecretService() secret.Service
	RegistryServiceFromRepo(repo *model.Repo) registry.Service
	RegistryService() registry.Service
	ConfigServiceFromRepo(repo *model.Repo) config.Service
	EnvironmentService() environment.Service
	ForgeFromRepo(repo *model.Repo) (forge.Forge, error)
	ForgeFromUser(user *model.User) (forge.Forge, error)
	ForgeByID(forgeID int64) (forge.Forge, error)
	// Store returns the store used by the manager. This is the encrypted store
	// when encryption is configured, otherwise the base store.
	Store() store.Store
}

func NewManager

func NewManager(c *cli.Command, baseStore store.Store, setupForge SetupForge) (Manager, error)

type SetupForge

type SetupForge func(forge *model.Forge) (forge.Forge, error)

type Store

type Store interface {
	store.Store
}

Store interface for maintenance service (to avoid circular imports).

Jump to

Keyboard shortcuts

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