config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2026 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthConfig

type AuthConfig struct {
	SessionTTL time.Duration    `yaml:"session_ttl"`
	Basic      BasicAuthConfig  `yaml:"basic"`
	GitHub     GitHubAuthConfig `yaml:"github"`
}

AuthConfig contains authentication settings.

type BasicAuthConfig

type BasicAuthConfig struct {
	Enabled bool       `yaml:"enabled"`
	Users   []UserAuth `yaml:"users"`
}

BasicAuthConfig contains basic auth settings.

type Config

type Config struct {
	Server     ServerConfig     `yaml:"server"`
	Database   DatabaseConfig   `yaml:"database"`
	GitHub     GitHubConfig     `yaml:"github"`
	Dispatcher DispatcherConfig `yaml:"dispatcher"`
	Auth       AuthConfig       `yaml:"auth"`
	History    HistoryConfig    `yaml:"history"`
	Groups     GroupsConfig     `yaml:"groups"`
}

Config is the root configuration for dispatchoor.

func Load

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

Load reads and parses configuration from a YAML file.

func (*Config) GetDSN

func (c *Config) GetDSN() string

GetDSN returns the database connection string.

func (*Config) String

func (c *Config) String() string

String returns a sanitized string representation of the config (no secrets).

func (*Config) Validate

func (c *Config) Validate() error

Validate checks the configuration for errors.

type DatabaseConfig

type DatabaseConfig struct {
	Driver   string         `yaml:"driver"`
	SQLite   SQLiteConfig   `yaml:"sqlite"`
	Postgres PostgresConfig `yaml:"postgres"`
}

DatabaseConfig contains database connection settings.

type DispatcherConfig

type DispatcherConfig struct {
	Enabled          bool          `yaml:"enabled"`
	Interval         time.Duration `yaml:"interval"`
	TrackingInterval time.Duration `yaml:"tracking_interval"`
}

DispatcherConfig contains dispatch loop settings.

type GitHubAuthConfig

type GitHubAuthConfig struct {
	Enabled         bool              `yaml:"enabled"`
	ClientID        string            `yaml:"client_id"`
	ClientSecret    string            `yaml:"client_secret"`
	RedirectURL     string            `yaml:"redirect_url"`
	OrgRoleMapping  map[string]string `yaml:"org_role_mapping"`
	UserRoleMapping map[string]string `yaml:"user_role_mapping"`
}

GitHubAuthConfig contains GitHub OAuth settings.

type GitHubConfig

type GitHubConfig struct {
	Token           string        `yaml:"token"`
	PollInterval    time.Duration `yaml:"poll_interval"`
	RateLimitBuffer int           `yaml:"rate_limit_buffer"`
}

GitHubConfig contains GitHub API settings.

type Group

type Group struct {
	ID                             string                     `yaml:"id"`
	Name                           string                     `yaml:"name"`
	Description                    string                     `yaml:"description"`
	RunnerLabels                   []string                   `yaml:"runner_labels"`
	WorkflowDispatchTemplates      []WorkflowDispatchTemplate `yaml:"workflow_dispatch_templates"`
	WorkflowDispatchTemplatesFiles []string                   `yaml:"workflow_dispatch_templates_files"`
	WorkflowDispatchTemplatesURLs  []string                   `yaml:"workflow_dispatch_templates_urls"`
}

Group represents a runner pool and its associated workflow dispatch jobs.

type GroupsConfig

type GroupsConfig struct {
	GitHub []Group `yaml:"github"`
}

GroupsConfig contains all group configurations.

type HistoryConfig

type HistoryConfig struct {
	RetentionDays   int           `yaml:"retention_days"`   // default 30, -1 to disable
	CleanupInterval time.Duration `yaml:"cleanup_interval"` // default 1h
}

HistoryConfig contains job history retention settings.

type PostgresConfig

type PostgresConfig struct {
	Host     string `yaml:"host"`
	Port     int    `yaml:"port"`
	User     string `yaml:"user"`
	Password string `yaml:"password"`
	Database string `yaml:"database"`
	SSLMode  string `yaml:"sslmode"`
}

PostgresConfig contains PostgreSQL-specific settings.

type SQLiteConfig

type SQLiteConfig struct {
	Path string `yaml:"path"`
}

SQLiteConfig contains SQLite-specific settings.

type ServerConfig

type ServerConfig struct {
	Listen      string   `yaml:"listen"`
	CORSOrigins []string `yaml:"cors_origins"`
}

ServerConfig contains HTTP server settings.

type UserAuth

type UserAuth struct {
	Username string `yaml:"username"`
	Password string `yaml:"password"`
	Role     string `yaml:"role"`
}

UserAuth represents a user configured for basic auth.

type WorkflowDispatchTemplate

type WorkflowDispatchTemplate struct {
	ID         string            `yaml:"id"`
	Name       string            `yaml:"name"`
	Owner      string            `yaml:"owner"`
	Repo       string            `yaml:"repo"`
	WorkflowID string            `yaml:"workflow_id"`
	Ref        string            `yaml:"ref"`
	Inputs     map[string]string `yaml:"inputs"`
	Labels     map[string]string `yaml:"labels"`
	SourceType string            `yaml:"-"` // "inline", "file", or "url" - set during loading
	SourcePath string            `yaml:"-"` // filename or URL (empty for inline) - set during loading
}

WorkflowDispatchTemplate represents a workflow dispatch template configuration.

Jump to

Keyboard shortcuts

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