config

package
v0.5.12 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2026 License: MIT Imports: 6 Imported by: 0 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

Overview

Package config provides configuration loading for Schedularr. Configuration structure and defaults are defined by CUE schemas in cmd/schema/. This package re-exports cueconfig types and provides loading helpers.

Package config provides configuration loading for Schedularr.

Index

Constants

View Source
const (
	// EnvConfigPath is the environment variable for config file path.
	EnvConfigPath = "SCHEDULARR_CONFIG"

	// EnvAPIToken is the *name* of the environment variable carrying the
	// `serve` command's bearer token -- not a credential itself, just the
	// key config.APIToken reads via os.Getenv. It always wins over the
	// api.token config key -- see APIToken.
	// #nosec G101 -- this is an env var name, not a hardcoded credential
	EnvAPIToken = "SCHEDULARR_API_TOKEN"

	// DefaultConfigDir is the default config directory name.
	DefaultConfigDir = ".schedularr"

	// DefaultDataDir is the default data directory name.
	DefaultDataDir = "schedularr"

	// DefaultConfigFile is the default config file name.
	DefaultConfigFile = "config.yaml"

	// DefaultLogsDir is the default logs directory name.
	DefaultLogsDir = "logs"
)

Variables

This section is empty.

Functions

func APIInsecureNoAuth

func APIInsecureNoAuth(cfg *Config) bool

APIInsecureNoAuth returns whether the `serve` command's API server should skip bearer-auth on /api/v1/* entirely (api.Config.InsecureNoAuth). Local development only.

func APIListen

func APIListen(cfg *Config) string

APIListen returns the configured address for the `serve` command's HTTP API server to listen on (host:port, or :port for all interfaces).

func APIToken

func APIToken(cfg *Config) string

APIToken returns the bearer token the `serve` command's API server requires on /api/v1/* requests. The SCHEDULARR_API_TOKEN environment variable always wins over the api.token config key: operators rotate a deployed token via the environment (a systemd unit's Environment=, a Docker secret, ...) independently of whatever's checked into the config file, and an env-var override is easier to keep out of version control than a config value.

func CronInterval

func CronInterval(cfg *Config) time.Duration

CronInterval returns the configured interval between the `serve` command's cron-loop schedule regenerate-and-apply cycles, CUE-defaulting to 6h when the config file doesn't set cron_interval. This is a top-level key, not under api.*, because it governs the scheduler's cron behavior, not the HTTP server -- `serve --interval`/`-i` overrides this value when passed explicitly (flag > config > 6h default).

func DatabasePath

func DatabasePath(cfg *Config) string

DatabasePath returns the configured database path.

func EnsureDirectories

func EnsureDirectories(p *Paths) error

EnsureDirectories creates all required directories if they don't exist. Uses os.MkdirAll with 0750 permissions (owner: rwx, group: rx, others: none).

func FindConfigFile

func FindConfigFile(flagValue string) string

FindConfigFile searches for a config file in standard locations. Returns the path to the first existing config file, or empty string if none found.

func LogFormat

func LogFormat(cfg *Config) string

LogFormat returns the configured log format.

func LogLevel

func LogLevel(cfg *Config) string

LogLevel returns the configured log level.

func LogTimezone

func LogTimezone(cfg *Config) string

LogTimezone returns the configured timezone.

func LogsDir

func LogsDir(cfg *Config) string

LogsDir returns the configured logs directory from the app config, or the default path if not configured.

func MaintenanceApplyRunRetention added in v0.5.7

func MaintenanceApplyRunRetention(cfg *Config) time.Duration

MaintenanceApplyRunRetention returns how long apply-run records and their warnings are kept (default 90 days).

func MaintenanceCleanupEnabled

func MaintenanceCleanupEnabled(cfg *Config) bool

MaintenanceCleanupEnabled returns whether cleanup is enabled.

func MaintenanceHistoryRetention

func MaintenanceHistoryRetention(cfg *Config) time.Duration

MaintenanceHistoryRetention returns the history retention duration.

func MaintenanceSnapshotRetention added in v0.5.7

func MaintenanceSnapshotRetention(cfg *Config) time.Duration

MaintenanceSnapshotRetention returns how long series occurrence snapshots are kept. Split from history_retention in v0.5.7 so the two tables prune on their own clocks.

func SchedulerFilePath

func SchedulerFilePath(cfg *Config) string

SchedulerFilePath returns the configured path of the scheduler.yaml import file (see blockio.Bootstrap). scheduler.yaml is import-only: it seeds the block store on first run and is otherwise ignored, so this is only ever consulted for that one-time bootstrap.

func TunarrConfig

func TunarrConfig(cfg *Config) tunarr.Config

TunarrConfig extracts Tunarr client configuration from the loaded config.

Types

type Config

type Config = cueconfig.Config

Config is an alias for cueconfig.Config All config access should use the accessor methods (GetString, GetInt, etc.)

func Load

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

Load loads configuration from a file using CUE validation and defaults.

type Paths

type Paths struct {
	ConfigFile string
	ConfigDir  string
	LogsDir    string
	DataDir    string
}

Paths holds resolved paths for Schedularr directories and files.

func DefaultPaths

func DefaultPaths() (*Paths, error)

DefaultPaths returns OS-agnostic default paths based on user home directory. Config: $HOME/.schedularr/config.yaml Logs: $HOME/schedularr/logs/

func ResolvePaths

func ResolvePaths(flagValue string) (*Paths, error)

ResolvePaths determines paths using the priority: flag > env > default. The flagValue parameter is the --config flag value (empty if not set).

Jump to

Keyboard shortcuts

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