config

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Command to execute (after --)
	Command []string

	// Timeout for command execution (0 = no timeout)
	Timeout time.Duration

	// Maximum runtime before forced termination
	MaxRuntime time.Duration

	// Restart policy: never, always, on-failure
	Restart RestartPolicy

	// Maximum retry attempts (0 = unlimited when restart enabled)
	MaxRetries int

	// Grace period for graceful shutdown
	GracePeriod time.Duration

	// Health check command
	HealthCmd string

	// Health check interval
	HealthInterval time.Duration

	// Health check timeout
	HealthTimeout time.Duration

	// Alert methods: stderr, webhook, script
	AlertMethods []string

	// Webhook URL for alerts
	WebhookURL string

	// Custom alert script
	AlertCmd string

	// Log format: text, json
	LogFormat LogFormat

	// Exit codes to treat as success
	SuccessExitCodes []int

	// Exit codes to treat as failure (trigger restart)
	FailureExitCodes []int

	// Idle timeout (no output)
	IdleTimeout time.Duration

	// Config file path
	ConfigFile string
}

func Default

func Default() *Config

func LoadFromFile

func LoadFromFile(path string) (*Config, error)

type LogFormat

type LogFormat string
const (
	LogFormatText LogFormat = "text"
	LogFormatJSON LogFormat = "json"
)

type RestartPolicy

type RestartPolicy string
const (
	RestartNever     RestartPolicy = "never"
	RestartAlways    RestartPolicy = "always"
	RestartOnFailure RestartPolicy = "on-failure"
)

type YAMLConfig

type YAMLConfig struct {
	Timeout        string   `yaml:"timeout"`
	MaxRuntime     string   `yaml:"max_runtime"`
	Restart        string   `yaml:"restart"`
	MaxRetries     int      `yaml:"max_retries"`
	GracePeriod    string   `yaml:"grace_period"`
	HealthCmd      string   `yaml:"health_cmd"`
	HealthInterval string   `yaml:"health_interval"`
	HealthTimeout  string   `yaml:"health_timeout"`
	Alert          []string `yaml:"alert"`
	WebhookURL     string   `yaml:"webhook_url"`
	AlertCmd       string   `yaml:"alert_cmd"`
	LogFormat      string   `yaml:"log_format"`
	SuccessCodes   []int    `yaml:"success_codes"`
	FailureCodes   []int    `yaml:"failure_codes"`
	IdleTimeout    string   `yaml:"idle_timeout"`
}

Jump to

Keyboard shortcuts

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