Documentation
¶
Index ¶
- Constants
- func InitAll(ctx context.Context) error
- func IsLicensed(name string) bool
- func LoadAll() error
- func MigrateAll(ctx context.Context, x *xorm.Engine) error
- func Register(p Plugin)
- func RegisterAPIRoutes(m any)
- func RegisterModels() []any
- func RegisterRepoAPIRoutes(m any)
- func RegisterRepoWebRoutes(m any)
- func RegisterWebRoutes(m any)
- func ShutdownAll(ctx context.Context)
- type APIRoutesPlugin
- type DatabasePlugin
- type LicenseInfo
- type LicenseLimits
- type LicensedPlugin
- type Plugin
- type RepoRoutesPlugin
- type WebRoutesPlugin
Constants ¶
const ( TierSolo = "solo" TierPro = "pro" TierTeam = "team" TierEnterprise = "enterprise" )
License tier constants
Variables ¶
This section is empty.
Functions ¶
func IsLicensed ¶
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 MigrateAll ¶
MigrateAll runs migrations for all database plugins
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
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
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
Source Files
¶
- loader.go
- plugin.go
- registry.go