config

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigLoaded

func ConfigLoaded() bool

func DisableAllJobs

func DisableAllJobs()

func EnableAllJobs

func EnableAllJobs()

func EnableNonScheduledJobs

func EnableNonScheduledJobs()

func EnableScheduledJobs

func EnableScheduledJobs()

func GetAllCrons

func GetAllCrons() map[string][]Job

func GetCommandsForJob added in v0.10.0

func GetCommandsForJob(job *Job) []string

func GetConfigFilePath added in v0.9.11

func GetConfigFilePath() string

func GetConfigFolderPath added in v0.9.11

func GetConfigFolderPath() string

func GetDBLocation added in v0.9.12

func GetDBLocation() string

func GetDBName added in v0.9.12

func GetDBName() string

func GetDefaultConfigFile added in v0.9.11

func GetDefaultConfigFile() string

func GetDefaultConfigFolder added in v0.9.11

func GetDefaultConfigFolder() string

func GetDeleteRunsAfterDays

func GetDeleteRunsAfterDays() int

func GetJobsCron

func GetJobsCron(job *Job) string

func GetLogLevel

func GetLogLevel() slog.Level

func GetRetriesForJob added in v0.10.0

func GetRetriesForJob(job *Job) int

func GetServer

func GetServer() string

func GetTimeoutForJob added in v0.10.0

func GetTimeoutForJob(job *Job) time.Duration

func New

func New(configFilePath string)

func SetConfigFilePath added in v0.9.11

func SetConfigFilePath(file string)

func SetConfigFolderPath added in v0.9.11

func SetConfigFolderPath(folder string)

func ToggleDisabledJob

func ToggleDisabledJob(name string) error

func ValidateAndLoadConfig

func ValidateAndLoadConfig(v *viper.Viper) error

Types

type AllowedCommands

type AllowedCommands struct {
	AllowAllArgs bool     `mapstructure:"allow_all_args"`
	Args         []string `mapstructure:"args"`
	// New field to store pre-processed arguments
	AllowedArgsMap map[string]struct{}
}

type DBSettings added in v0.9.12

type DBSettings struct {
	Location string `mapstructure:"location"`
	Name     string `mapstructure:"name"`
}

type Env

type Env struct {
	Key   string `mapstructure:"key" validate:"required"`
	Value string `mapstructure:"value" validate:"required"`
}

type GlobalConfig

type GlobalConfig struct {
	LogLevel            string           `mapstructure:"log_level" validate:"omitempty,oneof=debug info warn error"`
	TimeZone            string           `mapstructure:"time_zone" validate:"omitempty,timezone"`
	DeleteRunsAfterDays int              `mapstructure:"delete_runs_after_days" validate:"gte=0"`
	DB                  DBSettings       `mapstructure:"db"`
	Jobs                []Job            `mapstructure:"jobs" validate:"omitempty,dive"`
	JobDefaults         JobDefaults      `mapstructure:"job_defaults"`
	Healthcheck         HealthCheck      `mapstructure:"healthcheck" validate:"omitempty"`
	Server              ServerSettings   `mapstructure:"server"`
	Terminal            TerminalSettings `mapstructure:"terminal" validate:"omitempty"`
	Software            []Software       `mapstructure:"software" validate:"omitempty,dive"`
}

type HealthCheck

type HealthCheck struct {
	Authorization string `mapstructure:"authorization"`
	Type          string `mapstructure:"type" validate:"omitempty,oneof=HEAD GET POST"`
	Start         Url    `mapstructure:"start" validate:"omitempty"`
	End           Url    `mapstructure:"end" validate:"omitempty"`
	Failure       Url    `mapstructure:"failure" validate:"omitempty"`
}

func GetHealthcheck

func GetHealthcheck() HealthCheck

type Job

type Job struct {
	Name            string        `mapstructure:"name" validate:"required" json:"name"`
	Slug            string        `mapstructure:"-" json:"slug"`
	Cron            string        `mapstructure:"cron" validate:"omitempty,cron" json:"cron"`
	DisableCron     bool          `mapstructure:"disable_cron" json:"disable_cron"`
	DisableFailFast bool          `mapstructure:"disable_fail_fast" json:"disable_fail_fast"`
	Timeout         time.Duration `mapstructure:"timeout" validate:"gte=0" json:"timeout,omitempty"`
	Retries         int           `mapstructure:"retries" validate:"gte=0" json:"retries,omitempty"`
	Envs            []Env         `mapstructure:"envs" validate:"dive" json:"-"`
	Commands        []string      `mapstructure:"commands" validate:"required" json:"-"`
	Disabled        bool          `json:"disabled"`
}

func GetJobByName

func GetJobByName(name string) *Job

func GetJobs

func GetJobs() []Job

type JobDefaults

type JobDefaults struct {
	Cron         string        `mapstructure:"cron" validate:"omitempty,cron"`
	Timeout      time.Duration `mapstructure:"timeout" validate:"gte=0"`
	Retries      int           `mapstructure:"retries" validate:"gte=0"`
	Envs         []Env         `mapstructure:"envs" validate:"dive"`
	PreCommands  []string      `mapstructure:"pre_commands"`
	PostCommands []string      `mapstructure:"post_commands"`
}

type OrderedEnvs

type OrderedEnvs struct {
	Order []string
	Data  map[string]string
}

func GetEnvsForJob added in v0.10.0

func GetEnvsForJob(job *Job) OrderedEnvs

type ServerSettings

type ServerSettings struct {
	Address string `mapstructure:"address" validate:"required,ipv4"`
	Port    int    `mapstructure:"port" validate:"required,gte=1024,lte=65535"`
}

type Software

type Software struct {
	Name    string `mapstructure:"name" validate:"required"`
	Version string `mapstructure:"version"`
}

type TerminalSettings

type TerminalSettings struct {
	AllowAllCommands bool                       `mapstructure:"allow_all_commands"`
	AllowedCommands  map[string]AllowedCommands `mapstructure:"allowed_commands" validate:"required_if=AllowAllCommands false,dive"`
}

func GetTerminalSettings

func GetTerminalSettings() TerminalSettings

func (*TerminalSettings) Hydrate

func (s *TerminalSettings) Hydrate()

type Url

type Url struct {
	Url    string         `mapstructure:"url" validate:"required,url"`
	Params map[string]any `mapstructure:"params"`
	Body   string         `mapstructure:"body"`
}

Jump to

Keyboard shortcuts

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