domain

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2026 License: AGPL-3.0 Imports: 2 Imported by: 0

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"`
	Author          string          `json:"author"`
	Repo            string          `json:"repo"`
	Docs            string          `json:"docs,omitempty"`
	Image           string          `json:"image"`
	Version         string          `json:"version"`
	MinKleffVersion string          `json:"minKleffVersion,omitempty"`
	License         string          `json:"license,omitempty"`
	Verified        bool            `json:"verified"`
	Screenshots     []string        `json:"screenshots,omitempty"`
	Config          []ConfigField   `json:"config,omitempty"`
	Companions      []CompanionSpec `json:"companions,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 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"`

	// 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"`
}

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"`
}

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

	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"
)

Jump to

Keyboard shortcuts

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