Documentation
¶
Overview ¶
Package extension provides a Forge extension adapter for the ctrlplane. It enables mounting CtrlPlane into a Forge application with automatic DI resolution, route registration, and lifecycle management.
Index ¶
- Constants
- type Config
- type ExtOption
- type Extension
- func (e *Extension) API() *api.API
- func (e *Extension) CtrlPlane() *app.CtrlPlane
- func (e *Extension) Dependencies() []string
- func (e *Extension) Description() string
- func (e *Extension) Handler() http.Handler
- func (e *Extension) Health(ctx context.Context) error
- func (e *Extension) Init(fapp forge.App) error
- func (e *Extension) Name() string
- func (e *Extension) Register(fapp forge.App) error
- func (e *Extension) RegisterRoutes(router forge.Router)
- func (e *Extension) Start(ctx context.Context) error
- func (e *Extension) Stop(ctx context.Context) error
- func (e *Extension) Version() string
Constants ¶
const ExtensionDescription = "CtrlPlane control plane for managing cloud infrastructure and deployments"
const ExtensionName = "ctrlplane"
ExtensionName is the name registered with Forge.
const ExtensionVersion = "0.1.0"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Config embeds the core ctrlplane configuration.
ctrlplane.Config
// BasePath is the URL prefix for all ctrlplane routes.
BasePath string `default:"/api/cp" json:"base_path"`
// AuthProvider is an explicitly configured auth provider.
// If nil, the extension auto-discovers from Forge's DI container.
AuthProvider auth.Provider `json:"-"`
// DisableRoutes disables the registration of routes.
DisableRoutes bool `default:"false" json:"disable_routes"`
}
Config holds configuration for the CtrlPlane Forge extension.
func (Config) ToCtrlPlaneConfig ¶
ToCtrlPlaneConfig returns the embedded ctrlplane config.
type ExtOption ¶
type ExtOption func(*Extension)
ExtOption configures the CtrlPlane Forge extension.
func WithAuthProvider ¶
WithAuthProvider sets an explicit auth provider instead of auto-discovery.
func WithBasePath ¶
WithBasePath sets the URL prefix for all ctrlplane routes.
func WithConfig ¶
WithConfig sets the extension configuration directly.
func WithProvider ¶
WithProvider registers a cloud/orchestrator provider.
type Extension ¶
type Extension struct {
// contains filtered or unexported fields
}
Extension adapts CtrlPlane as a Forge extension. It implements the forge.Extension interface when used with Forge.
func (*Extension) CtrlPlane ¶
CtrlPlane returns the underlying CtrlPlane instance. This is nil until Init is called.
func (*Extension) Dependencies ¶
Dependencies returns the list of extension names this extension depends on. CtrlPlane has no required dependencies, but can optionally use auth extensions.
func (*Extension) Description ¶
func (*Extension) Handler ¶
Handler returns the HTTP handler for all API routes. This is a convenience method for standalone use.
func (*Extension) Health ¶
Health implements forge.Extension.
func (*Extension) Init ¶
Init initializes the extension. In a Forge environment, this is called during app setup. For standalone use, call it manually.
func (*Extension) Register ¶
Register implements forge.Extension.
func (*Extension) RegisterRoutes ¶
RegisterRoutes registers all ctrlplane API routes into a Forge router with full OpenAPI metadata. Use this for Forge extension integration where the parent app owns the router.
func (*Extension) Version ¶
Version implements forge.Extension.