plugins

package
v3.1.12 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TierSolo       = "solo"
	TierPro        = "pro"
	TierTeam       = "team"
	TierEnterprise = "enterprise"
)

License tier constants

Variables

This section is empty.

Functions

func InitAll

func InitAll(ctx context.Context) error

InitAll initializes all registered plugins

func IsLicensed

func IsLicensed(name string) bool

IsLicensed checks if a plugin is properly licensed For licensed plugins without a valid license, this returns true because we default to Solo tier (free) when no license is present

func LoadAll

func LoadAll() error

LoadAll loads all plugins from the configured plugin directory

func MigrateAll

func MigrateAll(ctx context.Context, x *xorm.Engine) error

MigrateAll runs migrations for all database plugins

func Register

func Register(p Plugin)

Register adds a plugin to the registry

func RegisterAPIRoutes

func RegisterAPIRoutes(m any)

RegisterAPIRoutes registers API routes from all plugins

func RegisterModels

func RegisterModels() []any

RegisterModels registers database models from all plugins

func RegisterRepoAPIRoutes

func RegisterRepoAPIRoutes(m any)

RegisterRepoAPIRoutes registers per-repository API routes from all plugins

func RegisterRepoWebRoutes

func RegisterRepoWebRoutes(m any)

RegisterRepoWebRoutes registers per-repository web routes from all plugins

func RegisterWebRoutes

func RegisterWebRoutes(m any)

RegisterWebRoutes registers web UI routes from all plugins

func ShutdownAll

func ShutdownAll(ctx context.Context)

ShutdownAll shuts down all registered plugins

Types

type APIRoutesPlugin

type APIRoutesPlugin interface {
	Plugin

	// RegisterAPIRoutes adds routes to the API router
	// The router is a *web.Router from the gitcaddy server
	RegisterAPIRoutes(m any)
}

APIRoutesPlugin is implemented by plugins that add API routes

type DatabasePlugin

type DatabasePlugin interface {
	Plugin

	// RegisterModels returns the models to be registered with the database
	RegisterModels() []any

	// Migrate runs any database migrations for this plugin
	Migrate(ctx context.Context, x *xorm.Engine) error
}

DatabasePlugin is implemented by plugins that need database tables

type LicenseInfo

type LicenseInfo struct {
	Valid       bool
	Tier        string // e.g., "solo", "pro", "team", "enterprise"
	CustomerID  string
	ExpiresAt   int64
	GracePeriod bool // true if in grace period after expiry
}

LicenseInfo contains license details

func DefaultSoloLicense

func DefaultSoloLicense() *LicenseInfo

DefaultSoloLicense returns the default Solo tier license (free, no registration required)

func GetLicenseInfo

func GetLicenseInfo(name string) *LicenseInfo

GetLicenseInfo returns license info for a plugin If the plugin doesn't have a license set, returns the default Solo license

type LicenseLimits

type LicenseLimits struct {
	Users              int  // Max users with vault access (-1 = unlimited)
	SecretsPerRepo     int  // Max secrets per repo (-1 = unlimited)
	AuditRetentionDays int  // Days to keep audit logs
	VersioningEnabled  bool // Can use secret versioning/rollback
	MaxVersions        int  // Max versions to keep per secret (-1 = unlimited, 0 = disabled)
	CICDTokensEnabled  bool // Can create CI/CD tokens
	MaxTokens          int  // Max CI/CD tokens per repo (-1 = unlimited, 0 = disabled)
	MaxTokenTTLHours   int  // Max token TTL in hours (-1 = unlimited)
	TokensReadOnly     bool // If true, tokens can only read secrets (not write)
	SSOEnabled         bool // Can use SSO/SAML
}

LicenseLimits defines the limits for each tier

func GetLicenseLimits

func GetLicenseLimits(name string) *LicenseLimits

GetLicenseLimits returns the license limits for a plugin

func GetLimitsForTier

func GetLimitsForTier(tier string) *LicenseLimits

GetLimitsForTier returns the limits for a given license tier

type LicensedPlugin

type LicensedPlugin interface {
	Plugin

	// ValidateLicense checks if the plugin is properly licensed
	ValidateLicense(ctx context.Context) error

	// LicenseInfo returns information about the current license
	LicenseInfo() *LicenseInfo
}

LicensedPlugin is implemented by plugins that require a license

type Plugin

type Plugin interface {
	// Name returns the unique identifier for this plugin
	Name() string

	// Version returns the plugin version
	Version() string

	// Description returns a human-readable description
	Description() string

	// Init is called when the plugin is loaded
	Init(ctx context.Context) error

	// Shutdown is called when the server is shutting down
	Shutdown(ctx context.Context) error
}

Plugin defines the interface that all GitCaddy plugins must implement

func All

func All() []Plugin

All returns all registered plugins

func Get

func Get(name string) Plugin

Get returns a plugin by name

type RepoRoutesPlugin

type RepoRoutesPlugin interface {
	Plugin

	// RegisterRepoWebRoutes adds routes under /{owner}/{repo}/
	// The router is a *web.Router from the gitcaddy server
	RegisterRepoWebRoutes(m any)

	// RegisterRepoAPIRoutes adds routes under /api/v1/repos/{owner}/{repo}/
	// The router is a *web.Router from the gitcaddy server
	RegisterRepoAPIRoutes(m any)
}

RepoRoutesPlugin is implemented by plugins that add per-repository routes

type WebRoutesPlugin

type WebRoutesPlugin interface {
	Plugin

	// RegisterWebRoutes adds routes to the web UI router
	// The router is a *web.Router from the gitcaddy server
	RegisterWebRoutes(m any)
}

WebRoutesPlugin is implemented by plugins that add web UI routes

Source Files

  • loader.go
  • plugin.go
  • registry.go

Jump to

Keyboard shortcuts

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