cli

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2025 License: MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const UserContainerDefault = "default"

UserContainerDefault is the sentinel value that explicitly requests the container's default user, overriding any global default-user setting.

Variables

View Source
var (
	ErrWebhookNameRequired = errors.New("webhook section must have a name")
	ErrWebAuthUsername     = errors.New("web-auth-enabled requires web-username to be set")
	ErrWebAuthPassword     = errors.New("web-auth-enabled requires web-password-hash to be set")
	ErrInvalidDockerFilter = errors.New("invalid docker filter format")
	ErrHealthCheckFailed   = errors.New("health check failed")
	ErrInvalidBcryptCost   = errors.New("bcrypt cost out of valid range")
	ErrPasswordTooShort    = errors.New("password must be at least 8 characters")
	ErrPasswordMismatch    = errors.New("passwords do not match")
	ErrUsernameEmpty       = errors.New("username cannot be empty")
	ErrUsernameTooShort    = errors.New("username must be at least 3 characters")
	ErrJobNameEmpty        = errors.New("job name cannot be empty")
	ErrJobNameInvalid      = errors.New("job name must be alphanumeric with hyphens or underscores only")
	ErrDockerImageEmpty    = errors.New("Docker image cannot be empty")
	ErrCommandEmpty        = errors.New("command cannot be empty")
	ErrScheduleEmpty       = errors.New("schedule cannot be empty")
)

Validation errors

View Source
var Deprecations = []Deprecation{
	{
		Option:         "slack-webhook",
		Replacement:    "[webhook \"name\"] sections with preset=slack",
		RemovalVersion: "v1.0.0",
		Message: `Please migrate to the new webhook notification system:
  [webhook "slack"]
  preset = slack
  id = T.../B...
  secret = XXXX...

See documentation: https://github.com/netresearch/ofelia#webhook-notifications`,
		CheckFunc: func(cfg *Config) bool {

			if cfg.Global.SlackWebhook != "" {
				return true
			}

			for _, job := range cfg.ExecJobs {
				if job.SlackWebhook != "" {
					return true
				}
			}
			for _, job := range cfg.RunJobs {
				if job.SlackWebhook != "" {
					return true
				}
			}
			for _, job := range cfg.LocalJobs {
				if job.SlackWebhook != "" {
					return true
				}
			}
			for _, job := range cfg.ComposeJobs {
				if job.SlackWebhook != "" {
					return true
				}
			}
			for _, job := range cfg.ServiceJobs {
				if job.SlackWebhook != "" {
					return true
				}
			}
			return false
		},

		MigrateFunc: nil,
	},
	{
		Option:         "poll-interval",
		Replacement:    "config-poll-interval and docker-poll-interval",
		RemovalVersion: "v1.0.0",
		Message:        "Use 'config-poll-interval' for INI file watching and 'docker-poll-interval' for container polling fallback.",
		KeyName:        "pollinterval",
		CheckFunc: func(cfg *Config) bool {
			return cfg.Docker.PollInterval > 0
		},
		MigrateFunc: func(cfg *Config) {
			if cfg.Docker.PollInterval <= 0 {
				return
			}

			if cfg.Docker.ConfigPollInterval == 10*time.Second {
				cfg.Docker.ConfigPollInterval = cfg.Docker.PollInterval
			}

			if !cfg.Docker.UseEvents && cfg.Docker.DockerPollInterval == 0 {
				cfg.Docker.DockerPollInterval = cfg.Docker.PollInterval
			}

			if cfg.Docker.PollingFallback == 10*time.Second {
				cfg.Docker.PollingFallback = cfg.Docker.PollInterval
			}
		},
	},
	{
		Option:         "no-poll",
		Replacement:    "docker-poll-interval=0",
		RemovalVersion: "v1.0.0",
		Message:        "Use 'docker-poll-interval=0' to disable container polling.",
		KeyName:        "nopoll",
		CheckFunc: func(cfg *Config) bool {
			return cfg.Docker.DisablePolling
		},
		MigrateFunc: func(cfg *Config) {
			if !cfg.Docker.DisablePolling {
				return
			}
			cfg.Docker.DockerPollInterval = 0
			cfg.Docker.PollingFallback = 0
		},
	},
}

Deprecations is the central list of all deprecated configuration options

View Source
var ErrNoContainerWithOfeliaEnabled = errors.New("couldn't find containers with label 'ofelia.enabled=true'")
View Source
var ErrValidationFailed = errors.New("validation failed")

ErrValidationFailed is returned when struct validation fails.

Functions

func ApplyDeprecationMigrations added in v0.18.0

func ApplyDeprecationMigrations(cfg *Config)

ApplyDeprecationMigrations applies all BC migrations for deprecated options This should be called during config loading to ensure deprecated options still work

func ApplyDeprecationMigrationsWithKeys added in v0.18.0

func ApplyDeprecationMigrationsWithKeys(cfg *Config, usedKeys map[string]bool)

ApplyDeprecationMigrationsWithKeys applies all BC migrations using key presence when available This should be called during config loading to ensure deprecated options still work

func ApplyLogLevel added in v0.8.0

func ApplyLogLevel(level string) error

ApplyLogLevel sets the global logging level if level is valid. Returns an error if the level is invalid, with a list of valid options.

func ResetDeprecationWarnings added in v0.18.0

func ResetDeprecationWarnings()

ResetDeprecationWarnings resets the warning state for a new config load cycle

func ValidateConfig added in v0.18.0

func ValidateConfig(cfg interface{}) error

ValidateConfig validates a configuration struct using struct tags

Types

type CheckResult added in v0.11.1

type CheckResult struct {
	Category string   `json:"category"`
	Name     string   `json:"name"`
	Status   string   `json:"status"` // "pass", "fail", "skip"
	Message  string   `json:"message,omitempty"`
	Hints    []string `json:"hints,omitempty"`
}

CheckResult represents the result of a single health check

type ComposeJobConfig added in v0.9.0

type ComposeJobConfig struct {
	core.ComposeJob           `mapstructure:",squash"`
	middlewares.OverlapConfig `mapstructure:",squash"`
	middlewares.SlackConfig   `mapstructure:",squash"`
	middlewares.SaveConfig    `mapstructure:",squash"`
	middlewares.MailConfig    `mapstructure:",squash"`
	JobWebhookConfig          `mapstructure:",squash"`
	JobSource                 JobSource `json:"-" mapstructure:"-"`
}

func (*ComposeJobConfig) GetJobSource added in v0.9.0

func (c *ComposeJobConfig) GetJobSource() JobSource

func (*ComposeJobConfig) SetJobSource added in v0.9.0

func (c *ComposeJobConfig) SetJobSource(s JobSource)

type Config

type Config struct {
	Global struct {
		middlewares.SlackConfig `mapstructure:",squash"`
		middlewares.SaveConfig  `mapstructure:",squash"`
		middlewares.MailConfig  `mapstructure:",squash"`
		LogLevel                string        `gcfg:"log-level" mapstructure:"log-level" validate:"omitempty,oneof=debug info notice warning error critical"` //nolint:revive
		EnableWeb               bool          `gcfg:"enable-web" mapstructure:"enable-web" default:"false"`
		WebAddr                 string        `gcfg:"web-address" mapstructure:"web-address" default:":8081"`
		WebAuthEnabled          bool          `gcfg:"web-auth-enabled" mapstructure:"web-auth-enabled" default:"false"`
		WebUsername             string        `gcfg:"web-username" mapstructure:"web-username"`
		WebPasswordHash         string        `gcfg:"web-password-hash" mapstructure:"web-password-hash"`
		WebSecretKey            string        `gcfg:"web-secret-key" mapstructure:"web-secret-key"`
		WebTokenExpiry          int           `gcfg:"web-token-expiry" mapstructure:"web-token-expiry" validate:"gte=1,lte=8760" default:"24"`           //nolint:revive
		WebMaxLoginAttempts     int           `gcfg:"web-max-login-attempts" mapstructure:"web-max-login-attempts" validate:"gte=1,lte=100" default:"5"` //nolint:revive
		EnablePprof             bool          `gcfg:"enable-pprof" mapstructure:"enable-pprof" default:"false"`
		PprofAddr               string        `gcfg:"pprof-address" mapstructure:"pprof-address" default:"127.0.0.1:8080"`
		MaxRuntime              time.Duration `gcfg:"max-runtime" mapstructure:"max-runtime" validate:"gte=0" default:"24h"`
		AllowHostJobsFromLabels bool          `gcfg:"allow-host-jobs-from-labels" mapstructure:"allow-host-jobs-from-labels" default:"false"` //nolint:revive
		EnableStrictValidation  bool          `gcfg:"enable-strict-validation" mapstructure:"enable-strict-validation" default:"false"`
		// DefaultUser sets the default user for exec/run/service jobs when not specified per-job.
		// Set to empty string "" to use the container's default user.
		// Default: "nobody" (secure unprivileged user)
		DefaultUser string `gcfg:"default-user" mapstructure:"default-user" default:"nobody"`
		// NotificationCooldown sets the minimum time between duplicate error notifications.
		// When a job fails with the same error, notifications (Slack, email, save) will be
		// suppressed until this cooldown period expires. Set to 0 to disable deduplication.
		// Default: 0 (disabled - all notifications sent)
		NotificationCooldown time.Duration `gcfg:"notification-cooldown" mapstructure:"notification-cooldown" validate:"gte=0" default:"0"`
	}
	ExecJobs    map[string]*ExecJobConfig    `gcfg:"job-exec" mapstructure:"job-exec,squash"`
	RunJobs     map[string]*RunJobConfig     `gcfg:"job-run" mapstructure:"job-run,squash"`
	ServiceJobs map[string]*RunServiceConfig `gcfg:"job-service-run" mapstructure:"job-service-run,squash"`
	LocalJobs   map[string]*LocalJobConfig   `gcfg:"job-local" mapstructure:"job-local,squash"`
	ComposeJobs map[string]*ComposeJobConfig `gcfg:"job-compose" mapstructure:"job-compose,squash"`
	Docker      DockerConfig

	WebhookConfigs *WebhookConfigs
	// contains filtered or unexported fields
}

Config contains the configuration

func BuildFromFile

func BuildFromFile(filename string, logger core.Logger) (*Config, error)

BuildFromFile builds a scheduler using the config from one or multiple files. The filename may include glob patterns. When multiple files are matched, they are parsed in lexical order and merged.

func BuildFromString

func BuildFromString(configStr string, logger core.Logger) (*Config, error)

func NewConfig

func NewConfig(logger core.Logger) *Config

func (*Config) InitializeApp

func (c *Config) InitializeApp() error

Call this only once at app init

type ConfigShowCommand added in v0.11.1

type ConfigShowCommand struct {
	ConfigFile string `long:"config" env:"OFELIA_CONFIG" description:"configuration file" default:"/etc/ofelia/config.ini"`
	LogLevel   string `long:"log-level" env:"OFELIA_LOG_LEVEL" description:"Set log level (overrides config)"`
	Logger     core.Logger
}

ConfigShowCommand displays the effective runtime configuration

func (*ConfigShowCommand) Execute added in v0.11.1

func (c *ConfigShowCommand) Execute(_ []string) error

Execute runs the config show command

type DaemonCommand

type DaemonCommand struct {
	ConfigFile          string         `long:"config" env:"OFELIA_CONFIG" default:"/etc/ofelia/config.ini"`
	DockerFilters       []string       `short:"f" long:"docker-filter" env:"OFELIA_DOCKER_FILTER"`
	DockerPollInterval  *time.Duration `long:"docker-poll-interval" env:"OFELIA_POLL_INTERVAL"`
	DockerUseEvents     *bool          `long:"docker-events" env:"OFELIA_DOCKER_EVENTS"`
	DockerNoPoll        *bool          `long:"docker-no-poll" env:"OFELIA_DOCKER_NO_POLL"`
	LogLevel            string         `long:"log-level" env:"OFELIA_LOG_LEVEL"`
	EnablePprof         bool           `long:"enable-pprof" env:"OFELIA_ENABLE_PPROF"`
	PprofAddr           string         `long:"pprof-address" env:"OFELIA_PPROF_ADDRESS" default:"127.0.0.1:8080"`
	EnableWeb           bool           `long:"enable-web" env:"OFELIA_ENABLE_WEB"`
	WebAddr             string         `long:"web-address" env:"OFELIA_WEB_ADDRESS" default:":8081"`
	WebAuthEnabled      bool           `long:"web-auth-enabled" env:"OFELIA_WEB_AUTH_ENABLED"`
	WebUsername         string         `long:"web-username" env:"OFELIA_WEB_USERNAME"`
	WebPasswordHash     string         `long:"web-password-hash" env:"OFELIA_WEB_PASSWORD_HASH"`
	WebSecretKey        string         `long:"web-secret-key" env:"OFELIA_WEB_SECRET_KEY"`
	WebTokenExpiry      int            `long:"web-token-expiry" env:"OFELIA_WEB_TOKEN_EXPIRY" default:"24"`
	WebMaxLoginAttempts int            `long:"web-max-login-attempts" env:"OFELIA_WEB_MAX_LOGIN_ATTEMPTS" default:"5"`

	Logger core.Logger
	// contains filtered or unexported fields
}

DaemonCommand daemon process

func (*DaemonCommand) Config added in v0.8.0

func (c *DaemonCommand) Config() *Config

Config returns the active configuration used by the daemon.

func (*DaemonCommand) Execute

func (c *DaemonCommand) Execute(_ []string) error

Execute runs the daemon

type DecodeResult added in v0.18.0

type DecodeResult struct {
	// UsedKeys contains all keys that were present in the input
	UsedKeys map[string]bool

	// UnusedKeys contains keys that were in input but not matched to struct fields
	UnusedKeys []string
}

DecodeResult contains metadata from the decoding process

type Deprecation added in v0.18.0

type Deprecation struct {
	// Option is the deprecated option name (e.g., "slack-webhook", "poll-interval")
	Option string

	// Replacement describes what to use instead
	Replacement string

	// RemovalVersion is the version when this option will be removed
	RemovalVersion string

	// Message is an optional additional message with migration instructions
	Message string

	// KeyName is the configuration key name for presence-based detection.
	// When set, the deprecation is detected if the key is present in the config,
	// regardless of its value (even if set to zero/empty).
	// This is the normalized key name (lowercase, no separators).
	KeyName string

	// CheckFunc returns true if the deprecated option is in use
	// The function receives the global config and checks if the deprecated option is set
	// This is the fallback when KeyName is not set or usedKeys is not available.
	CheckFunc func(cfg *Config) bool

	// MigrateFunc applies backwards-compatible migration from deprecated to new options
	// This is called during config loading to ensure deprecated options still work
	MigrateFunc func(cfg *Config)
}

Deprecation defines a deprecated configuration option

func CheckDeprecations added in v0.18.0

func CheckDeprecations(cfg *Config) []Deprecation

CheckDeprecations is a convenience function to check for deprecated options Call this after loading/reloading config

func CheckDeprecationsWithKeys added in v0.18.0

func CheckDeprecationsWithKeys(cfg *Config, usedKeys map[string]bool) []Deprecation

CheckDeprecationsWithKeys is a convenience function to check for deprecated options with key presence Call this after loading/reloading config when you have key metadata available

type DeprecationRegistry added in v0.18.0

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

DeprecationRegistry tracks deprecated options and ensures warnings are shown once per config load

func GetDeprecationRegistry added in v0.18.0

func GetDeprecationRegistry() *DeprecationRegistry

GetDeprecationRegistry returns the global deprecation registry

func (*DeprecationRegistry) Check added in v0.18.0

func (r *DeprecationRegistry) Check(cfg *Config) []Deprecation

Check examines the config for deprecated options and logs warnings once per cycle Returns the list of deprecations that are in use

func (*DeprecationRegistry) CheckWithKeys added in v0.18.0

func (r *DeprecationRegistry) CheckWithKeys(cfg *Config, usedKeys map[string]bool) []Deprecation

CheckWithKeys examines the config for deprecated options using key presence when available. If usedKeys is provided and a deprecation has KeyName set, presence-based detection is used. Otherwise, falls back to value-based CheckFunc.

func (*DeprecationRegistry) ForDoctor added in v0.18.0

func (r *DeprecationRegistry) ForDoctor(cfg *Config) []Deprecation

ForDoctor returns all deprecated options in use without logging warnings This is used by 'ofelia doctor' to report deprecations

func (*DeprecationRegistry) ForDoctorWithKeys added in v0.18.0

func (r *DeprecationRegistry) ForDoctorWithKeys(cfg *Config, usedKeys map[string]bool) []Deprecation

ForDoctorWithKeys returns all deprecated options in use using key presence when available. This is used by 'ofelia doctor' to report deprecations with better detection.

func (*DeprecationRegistry) Reset added in v0.18.0

func (r *DeprecationRegistry) Reset()

Reset clears the warning state for a new config load cycle

func (*DeprecationRegistry) SetLogger added in v0.18.0

func (r *DeprecationRegistry) SetLogger(logger core.Logger)

SetLogger sets the logger for deprecation warnings

type DockerConfig added in v0.6.0

type DockerConfig struct {
	Filters []string `mapstructure:"filters"`

	// ConfigPollInterval controls how often to check for INI config file changes.
	// This is independent of container detection. Set to 0 to disable config file watching.
	ConfigPollInterval time.Duration `mapstructure:"config-poll-interval" validate:"gte=0" default:"10s"`

	// UseEvents enables Docker event-based container detection (recommended).
	// When enabled, Ofelia reacts immediately to container start/stop events.
	UseEvents bool `mapstructure:"events" default:"true"`

	// DockerPollInterval enables periodic polling for container changes.
	// This is a fallback for environments where Docker events don't work reliably.
	// Set to 0 (default) to disable explicit container polling.
	// WARNING: If both events and polling are enabled, this is usually wasteful.
	DockerPollInterval time.Duration `mapstructure:"docker-poll-interval" validate:"gte=0" default:"0"`

	// PollingFallback auto-enables container polling if event subscription fails.
	// This provides backwards compatibility and resilience.
	// Set to 0 to disable auto-fallback (will only log errors on event failure).
	// Default is 10s for backwards compatibility.
	PollingFallback time.Duration `mapstructure:"polling-fallback" validate:"gte=0" default:"10s"`

	// Deprecated: Use ConfigPollInterval and DockerPollInterval instead.
	// If set, this value is used for both config and container polling (BC).
	PollInterval time.Duration `mapstructure:"poll-interval" validate:"gte=0"`

	// Deprecated: Use DockerPollInterval=0 instead.
	// If true, disables container polling entirely.
	DisablePolling bool `mapstructure:"no-poll" default:"false"`
}

type DockerHandler

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

func NewDockerHandler

func NewDockerHandler(
	ctx context.Context,
	notifier dockerLabelsUpdate,
	logger core.Logger,
	cfg *DockerConfig,
	provider core.DockerProvider,
) (*DockerHandler, error)

func (*DockerHandler) GetDockerLabels

func (c *DockerHandler) GetDockerLabels() (map[string]map[string]string, error)

func (*DockerHandler) GetDockerProvider added in v0.12.0

func (c *DockerHandler) GetDockerProvider() core.DockerProvider

GetDockerProvider returns the DockerProvider interface for SDK-based operations. This is the preferred method for new code using the official Docker SDK.

func (*DockerHandler) Shutdown added in v0.8.0

func (c *DockerHandler) Shutdown(ctx context.Context) error

type DoctorCommand added in v0.11.1

type DoctorCommand struct {
	ConfigFile string `long:"config" description:"Path to configuration file"`
	LogLevel   string `long:"log-level" env:"OFELIA_LOG_LEVEL" description:"Set log level"`
	JSON       bool   `long:"json" description:"Output results as JSON"`
	Logger     core.Logger
	// contains filtered or unexported fields
}

DoctorCommand runs comprehensive health checks on Ofelia configuration and environment

func (*DoctorCommand) Execute added in v0.11.1

func (c *DoctorCommand) Execute(_ []string) error

Execute runs all health checks

type DoctorReport added in v0.11.1

type DoctorReport struct {
	Healthy bool          `json:"healthy"`
	Checks  []CheckResult `json:"checks"`
}

DoctorReport contains all health check results

type ExecJobConfig

type ExecJobConfig struct {
	core.ExecJob              `mapstructure:",squash"`
	middlewares.OverlapConfig `mapstructure:",squash"`
	middlewares.SlackConfig   `mapstructure:",squash"`
	middlewares.SaveConfig    `mapstructure:",squash"`
	middlewares.MailConfig    `mapstructure:",squash"`
	JobWebhookConfig          `mapstructure:",squash"`
	JobSource                 JobSource `json:"-" mapstructure:"-"`
}

ExecJobConfig contains all configuration params needed to build a ExecJob

func (*ExecJobConfig) GetJobSource added in v0.9.0

func (c *ExecJobConfig) GetJobSource() JobSource

func (*ExecJobConfig) SetJobSource added in v0.9.0

func (c *ExecJobConfig) SetJobSource(s JobSource)

type HashPasswordCommand added in v0.17.0

type HashPasswordCommand struct {
	Cost     int    `long:"cost" default:"12" description:"bcrypt cost factor (10-14 recommended)"`
	LogLevel string `long:"log-level" env:"OFELIA_LOG_LEVEL" description:"Set log level"`
	Logger   core.Logger
}

func (*HashPasswordCommand) Execute added in v0.17.0

func (c *HashPasswordCommand) Execute(_ []string) error

type InitCommand added in v0.11.1

type InitCommand struct {
	Output   string `long:"output" short:"o" description:"Output file path" default:"./ofelia.ini"`
	LogLevel string `long:"log-level" env:"OFELIA_LOG_LEVEL" description:"Set log level"`
	Logger   core.Logger
}

InitCommand creates an interactive wizard for generating Ofelia configuration

func (*InitCommand) Execute added in v0.11.1

func (c *InitCommand) Execute(_ []string) error

Execute runs the interactive configuration wizard

type JobSource added in v0.9.0

type JobSource string

JobSource indicates where a job configuration originated from.

const (
	JobSourceINI   JobSource = "ini"
	JobSourceLabel JobSource = "label"
)

type JobWebhookConfig added in v0.16.0

type JobWebhookConfig struct {
	// Webhooks is a comma-separated list of webhook names for this job
	Webhooks string `gcfg:"webhooks" mapstructure:"webhooks"`
}

JobWebhookConfig holds per-job webhook configuration

func (*JobWebhookConfig) GetWebhookNames added in v0.16.0

func (c *JobWebhookConfig) GetWebhookNames() []string

GetWebhookNames returns the list of webhook names for a job

type LocalJobConfig

type LocalJobConfig struct {
	core.LocalJob             `mapstructure:",squash"`
	middlewares.OverlapConfig `mapstructure:",squash"`
	middlewares.SlackConfig   `mapstructure:",squash"`
	middlewares.SaveConfig    `mapstructure:",squash"`
	middlewares.MailConfig    `mapstructure:",squash"`
	JobWebhookConfig          `mapstructure:",squash"`
	JobSource                 JobSource `json:"-" mapstructure:"-"`
}

LocalJobConfig contains all configuration params needed to build a RunJob

func (*LocalJobConfig) GetJobSource added in v0.9.0

func (c *LocalJobConfig) GetJobSource() JobSource

func (*LocalJobConfig) SetJobSource added in v0.9.0

func (c *LocalJobConfig) SetJobSource(s JobSource)

type ProgressIndicator added in v0.11.1

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

ProgressIndicator provides visual feedback for long-running operations

func NewProgressIndicator added in v0.11.1

func NewProgressIndicator(logger core.Logger, message string) *ProgressIndicator

NewProgressIndicator creates a new progress indicator If output is not a terminal (e.g., piped to file), it uses simple log messages instead of spinners

func (*ProgressIndicator) Start added in v0.11.1

func (p *ProgressIndicator) Start()

Start begins displaying the progress indicator

func (*ProgressIndicator) Stop added in v0.11.1

func (p *ProgressIndicator) Stop(success bool, resultMsg string)

Stop stops the progress indicator and shows completion message

func (*ProgressIndicator) Update added in v0.11.1

func (p *ProgressIndicator) Update(newMessage string)

Update changes the progress message (for multi-step operations)

type ProgressReporter added in v0.11.1

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

ProgressReporter provides structured progress reporting for multi-step operations

func NewProgressReporter added in v0.11.1

func NewProgressReporter(logger core.Logger, totalSteps int) *ProgressReporter

NewProgressReporter creates a new multi-step progress reporter

func (*ProgressReporter) Complete added in v0.11.1

func (pr *ProgressReporter) Complete(message string)

Complete marks all steps as complete

func (*ProgressReporter) Step added in v0.11.1

func (pr *ProgressReporter) Step(stepNum int, message string)

Step reports progress for a single step

type RunJobConfig

type RunJobConfig struct {
	core.RunJob               `mapstructure:",squash"`
	middlewares.OverlapConfig `mapstructure:",squash"`
	middlewares.SlackConfig   `mapstructure:",squash"`
	middlewares.SaveConfig    `mapstructure:",squash"`
	middlewares.MailConfig    `mapstructure:",squash"`
	JobWebhookConfig          `mapstructure:",squash"`
	JobSource                 JobSource `json:"-" mapstructure:"-"`
}

func (*RunJobConfig) GetJobSource added in v0.9.0

func (c *RunJobConfig) GetJobSource() JobSource

func (*RunJobConfig) Hash added in v0.10.1

func (c *RunJobConfig) Hash() (string, error)

Hash overrides BareJob.Hash() to include RunJob-specific fields

func (*RunJobConfig) SetJobSource added in v0.9.0

func (c *RunJobConfig) SetJobSource(s JobSource)

type RunServiceConfig

type RunServiceConfig struct {
	core.RunServiceJob        `mapstructure:",squash"`
	middlewares.OverlapConfig `mapstructure:",squash"`
	middlewares.SlackConfig   `mapstructure:",squash"`
	middlewares.SaveConfig    `mapstructure:",squash"`
	middlewares.MailConfig    `mapstructure:",squash"`
	JobWebhookConfig          `mapstructure:",squash"`
	JobSource                 JobSource `json:"-" mapstructure:"-"`
}

RunServiceConfig contains all configuration params needed to build a RunJob

func (*RunServiceConfig) GetJobSource added in v0.9.0

func (c *RunServiceConfig) GetJobSource() JobSource

func (*RunServiceConfig) SetJobSource added in v0.9.0

func (c *RunServiceConfig) SetJobSource(s JobSource)

type UnknownKeyWarning added in v0.18.0

type UnknownKeyWarning struct {
	Section    string
	Key        string
	Suggestion string // "did you mean?" suggestion, if available
}

UnknownKeyWarning represents a warning about an unknown configuration key

func GenerateUnknownKeyWarnings added in v0.18.0

func GenerateUnknownKeyWarnings(section string, unusedKeys []string, knownKeys []string) []UnknownKeyWarning

GenerateUnknownKeyWarnings generates warnings for unknown keys with suggestions

type ValidateCommand

type ValidateCommand struct {
	ConfigFile string `long:"config" env:"OFELIA_CONFIG" description:"configuration file" default:"/etc/ofelia/config.ini"`
	LogLevel   string `long:"log-level" env:"OFELIA_LOG_LEVEL" description:"Set log level (overrides config)"`
	Logger     core.Logger
}

ValidateCommand validates the config file

func (*ValidateCommand) Execute

func (c *ValidateCommand) Execute(_ []string) error

Execute runs the validation command

type WebhookConfigs added in v0.16.0

type WebhookConfigs struct {
	Global   *middlewares.WebhookGlobalConfig
	Webhooks map[string]*middlewares.WebhookConfig
	Manager  *middlewares.WebhookManager
}

WebhookConfigs holds all parsed webhook configurations

func NewWebhookConfigs added in v0.16.0

func NewWebhookConfigs() *WebhookConfigs

NewWebhookConfigs creates a new WebhookConfigs with defaults

func (*WebhookConfigs) InitManager added in v0.16.0

func (wc *WebhookConfigs) InitManager() error

InitManager initializes the webhook manager with the parsed configurations

Jump to

Keyboard shortcuts

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