Documentation
¶
Overview ¶
Package domain holds the core plugin domain types.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CatalogManifest ¶
type CatalogManifest struct {
ID string `json:"id"`
Name string `json:"name"`
Type string `json:"type"`
Description string `json:"description"`
LongDescription string `json:"longDescription,omitempty"`
Tags []string `json:"tags,omitempty"`
Capabilities []string `json:"capabilities,omitempty"`
Author string `json:"author"`
Repo string `json:"repo"`
Docs string `json:"docs,omitempty"`
Image string `json:"image"`
Version string `json:"version"`
FrontendURL string `json:"frontendUrl,omitempty"`
MinKleffVersion string `json:"minKleffVersion,omitempty"`
License string `json:"license,omitempty"`
Verified bool `json:"verified"`
Logo string `json:"logo,omitempty"`
Screenshots []string `json:"screenshots,omitempty"`
Config []ConfigField `json:"config,omitempty"`
Volumes []CompanionVolume `json:"volumes,omitempty"`
Companions []CompanionSpec `json:"companions,omitempty"`
// Dependencies lists plugin IDs that must be installed and enabled before
// this plugin can be installed. Example: ["billing-framework"].
Dependencies []string `json:"dependencies,omitempty"`
}
CatalogManifest is a plugin's entry in the remote plugin registry. Shape mirrors the kleff-plugin.json manifest documented in PLUGIN_SPEC.md.
type CompanionPort ¶ added in v0.1.2
type CompanionPort struct {
ContainerPort int `json:"container"`
HostPort int `json:"host,omitempty"` // 0 = auto-assign
Protocol string `json:"protocol,omitempty"` // default: "tcp"
}
CompanionPort maps a container port to an optional fixed host port.
type CompanionSpec ¶ added in v0.1.1
type CompanionSpec struct {
// ID is the container name on the kleff network, e.g. "keycloak".
// Must be unique across all installed plugins.
ID string `json:"id"`
// Image is the Docker image reference for the companion container.
Image string `json:"image"`
// Command overrides the container's default CMD, e.g. ["start-dev"].
Command []string `json:"command,omitempty"`
// Env is a set of static environment variables injected into the companion.
Env map[string]string `json:"env,omitempty"`
// Ports exposes companion container ports on the host.
Ports []CompanionPort `json:"ports,omitempty"`
// Volumes declares named volumes mounted into the companion for persistence.
Volumes []CompanionVolume `json:"volumes,omitempty"`
// SkipIfEnv names a plugin config key: if the user supplied a non-empty
// value for that key, the companion is not deployed (the user is providing
// their own external service instead).
SkipIfEnv string `json:"skipIfEnv,omitempty"`
// InternalAddr is the address the plugin should use to reach this companion
// when it is deployed (i.e. when SkipIfEnv is unset). The platform injects
// this value as the SkipIfEnv env var so the plugin always has a valid URL.
// Example: "http://keycloak:8080"
InternalAddr string `json:"internalAddr,omitempty"`
// WaitForTCP, if set, is a "host:port" address the platform will poll with
// TCP dial attempts before deploying this companion. Use this to ensure a
// dependency companion (e.g. a database) is fully accepting connections
// before the dependent service starts.
// Example: "zitadel-postgres:5432"
WaitForTCP string `json:"waitForTCP,omitempty"`
// User overrides the container's default user (UID or "name" or "name:group").
// Leave empty to use the image default. Set to "root" when the companion
// needs to write to a Docker volume that is owned by root (e.g. ZITADEL
// writing /machinekey/pat.token on first-instance init).
User string `json:"user,omitempty"`
}
CompanionSpec declares a dependency container that the platform spins up alongside the plugin container. The companion shares the plugin's network and is managed (deploy/remove) together with the plugin.
type CompanionVolume ¶ added in v0.1.1
type CompanionVolume struct {
Name string `json:"name"` // Docker volume name, e.g. "kleff-keycloak-data"
Target string `json:"target"` // Mount path inside container, e.g. "/opt/keycloak/data"
}
CompanionVolume maps a named Docker volume to a path inside the companion container.
type ConfigField ¶
type ConfigField struct {
// Key is the environment variable name injected into the container.
Key string `json:"key"`
// Label is the human-readable form field label.
Label string `json:"label"`
// Description is shown below the input field.
Description string `json:"description,omitempty"`
// Type is one of: string, secret, number, boolean, select, url.
Type string `json:"type"`
// Required indicates the admin must fill this in before installing.
Required bool `json:"required"`
// Default is the pre-filled default value (optional).
Default string `json:"default,omitempty"`
// Options is the list of choices for type "select".
Options []string `json:"options,omitempty"`
// Advanced indicates if the field should be tucked away in advanced settings
Advanced bool `json:"advanced,omitempty"`
}
ConfigField describes one configuration value the plugin expects. These are rendered as form fields in the Install/Configure modal and injected as environment variables into the plugin container.
type Plugin ¶
type Plugin struct {
// ID is the plugin manifest id, e.g. "idp-keycloak".
ID string
// Type is the plugin capability category, e.g. "idp".
Type string
// DisplayName is the human-readable label.
DisplayName string
// Image is the Docker image reference, e.g. "ghcr.io/kleff/idp-keycloak:1.0.0".
Image string
// Version is the installed version string, e.g. "1.0.0".
Version string
// GRPCAddr is the host:port the platform dials to reach the plugin container.
// e.g. "kleff-idp-keycloak:50051"
GRPCAddr string
// FrontendURL is the URL of the plugin's JS bundle served to the browser.
// e.g. "http://localhost:3001/plugin.js". Empty for backend-only plugins.
FrontendURL string
// Config holds non-secret configuration values as a JSON blob.
// Values are env-var key → value, e.g. {"KEYCLOAK_URL": "http://keycloak:8080"}.
Config json.RawMessage
// Secrets holds secret configuration values as an AES-256-GCM encrypted JSON blob.
// Never returned in API responses.
Secrets json.RawMessage
// Enabled controls whether this plugin is active.
Enabled bool
// Status is the in-memory runtime status (not persisted).
Status PluginStatus
// Dependencies is the list of plugin IDs this plugin declared as required at
// install time (copied from the catalog manifest).
Dependencies []string
InstalledAt time.Time
UpdatedAt time.Time
}
Plugin is a fully installed, persisted plugin instance. One record per installed plugin; the primary key is the plugin manifest ID (e.g. "idp-keycloak"), not a surrogate.
type PluginStatus ¶
type PluginStatus string
PluginStatus represents the runtime lifecycle state of a plugin.
const ( PluginStatusInstalling PluginStatus = "installing" PluginStatusRunning PluginStatus = "running" PluginStatusDisabled PluginStatus = "disabled" PluginStatusRemoving PluginStatus = "removing" PluginStatusError PluginStatus = "error" PluginStatusUnknown PluginStatus = "unknown" )