runtimehost

package
v1.2.20 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2026 License: Apache-2.0 Imports: 23 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const ConfigFileVersion = 1

Variables

This section is empty.

Functions

func NewHTTPHandler

func NewHTTPHandler(api http.Handler, webDirectory, desktopToken string, requestShutdown context.CancelFunc) (http.Handler, error)

func Run

func Run(ctx context.Context, config Config, logger *log.Logger) error

Run preserves the blocking CLI entrypoint while sharing the Host lifecycle used by embedded applications.

func WriteRuntimeUnits

func WriteRuntimeUnits(destination io.Writer) error

Types

type Config

type Config struct {
	Enabled               bool
	Mode                  Mode
	Address               string
	DataDirectory         string
	WebDirectory          string
	DesktopToken          string
	Version               string
	DefaultScope          string
	AutomationPeriod      time.Duration
	DisableAutomations    bool
	DisableEmbeddedWorker bool
}

func (Config) Validate

func (config Config) Validate() error

type FileConfig

type FileConfig struct {
	Version    int                    `yaml:"version" mapstructure:"version"`
	Runtime    FileRuntimeConfig      `yaml:"runtime" mapstructure:"runtime"`
	Desktop    FileDesktopConfig      `yaml:"desktop,omitempty" mapstructure:"desktop"`
	Storage    FileStorageConfig      `yaml:"storage,omitempty" mapstructure:"storage"`
	Redis      FileRedisConfig        `yaml:"redis,omitempty" mapstructure:"redis"`
	Extensions map[string]interface{} `yaml:"extensions,omitempty" mapstructure:"extensions"`
}

func LoadConfigFile

func LoadConfigFile(path string) (FileConfig, error)

func (FileConfig) Apply

func (fileConfig FileConfig) Apply(config Config) (Config, error)

func (FileConfig) Validate

func (config FileConfig) Validate() error

type FileDatabaseConfig

type FileDatabaseConfig struct {
	Driver string `yaml:"driver,omitempty" mapstructure:"driver"`
	DSN    string `yaml:"dsn,omitempty" mapstructure:"dsn"`
	DSNEnv string `yaml:"dsn_env,omitempty" mapstructure:"dsn_env"`
}

type FileDesktopConfig

type FileDesktopConfig struct {
	PreventSleep  *bool  `yaml:"prevent_sleep,omitempty" mapstructure:"prevent_sleep"`
	LaunchAtLogin *bool  `yaml:"launch_at_login,omitempty" mapstructure:"launch_at_login"`
	Language      string `yaml:"language,omitempty" mapstructure:"language"`
}

type FileRedisConfig

type FileRedisConfig struct {
	Mode        string `yaml:"mode,omitempty" mapstructure:"mode"`
	Address     string `yaml:"address,omitempty" mapstructure:"address"`
	Username    string `yaml:"username,omitempty" mapstructure:"username"`
	PasswordEnv string `yaml:"password_env,omitempty" mapstructure:"password_env"`
	Database    int    `yaml:"database,omitempty" mapstructure:"database"`
	TLS         bool   `yaml:"tls,omitempty" mapstructure:"tls"`
}

type FileRuntimeConfig

type FileRuntimeConfig struct {
	Enabled          *bool  `yaml:"enabled,omitempty" mapstructure:"enabled"`
	ListenHost       string `yaml:"listen_host,omitempty" mapstructure:"listen_host"`
	Port             *int   `yaml:"port,omitempty" mapstructure:"port"`
	DataDirectory    string `yaml:"data_directory,omitempty" mapstructure:"data_directory"`
	EmbeddedWorker   *bool  `yaml:"embedded_worker,omitempty" mapstructure:"embedded_worker"`
	Automations      *bool  `yaml:"automations,omitempty" mapstructure:"automations"`
	AutomationPeriod string `yaml:"automation_period,omitempty" mapstructure:"automation_period"`
}

type FileStorageConfig

type FileStorageConfig struct {
	Database FileDatabaseConfig `yaml:"database,omitempty" mapstructure:"database"`
}

type Host added in v1.2.12

type Host struct {
	// contains filtered or unexported fields
}

Host owns one single-node workflow runtime: scheduler, optional embedded worker, stores, automations, and HTTP transport. Constructing a disabled Host has no filesystem, network, or goroutine side effects.

func New added in v1.2.12

func New(config Config, logger *log.Logger) (*Host, error)

New constructs an explicitly enabled single-node host. It opens the runtime stores so callers can configure the embedded worker through Service before Start. When config.Enabled is false, New returns an inert Host.

func (*Host) Address added in v1.2.12

func (host *Host) Address() string

Address returns the bound address after Start. It is empty for a disabled or not-yet-started Host.

func (*Host) Service added in v1.2.12

func (host *Host) Service() *scheduler.Service

Service exposes the canonical scheduler so an embedding application can register Units or executors before Start.

func (*Host) Shutdown added in v1.2.12

func (host *Host) Shutdown(ctx context.Context) error

Shutdown is idempotent and closes the HTTP server, scheduler, database, and runtime-directory lock in ownership order.

func (*Host) Start added in v1.2.12

func (host *Host) Start(ctx context.Context) error

Start begins serving without blocking. Cancelling ctx gracefully shuts down the Host. Start may be called exactly once.

func (*Host) Wait added in v1.2.12

func (host *Host) Wait() error

Wait blocks until all Host resources are closed.

type Mode

type Mode string
const (
	ModeServer   Mode = "server"
	ModeDesktop  Mode = "desktop"
	ModeHeadless Mode = "headless"
)

Jump to

Keyboard shortcuts

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