config

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package config loads and validates the configuration of the foreman CLI.

Index

Constants

View Source
const EnvPrefix = "FOREMAN_"

Variables

View Source
var ErrInvalid = errors.New("config: invalid")

Functions

func ParseDuration

func ParseDuration(s string) (time.Duration, error)

func RedactURL

func RedactURL(raw string) string

Types

type Config

type Config struct {
	DatabaseURL     string   `yaml:"-"`
	DatabaseURLFile string   `yaml:"database_url_file"`
	Schema          string   `yaml:"schema"`
	Output          string   `yaml:"output"`
	Timeout         Duration `yaml:"timeout"`
	Log             Log      `yaml:"log"`
}

Config is the configuration of the foreman CLI.

func Default

func Default() Config

func Load

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

Load builds the configuration from defaults, the YAML file and environment variables.

func (Config) Redacted

func (c Config) Redacted() (string, error)

func (*Config) ResolveSecrets

func (c *Config) ResolveSecrets() error

func (Config) Validate

func (c Config) Validate(needDatabase bool) error

Validate reports every configuration problem at once.

type Duration

type Duration time.Duration

func (Duration) MarshalYAML

func (d Duration) MarshalYAML() (any, error)

func (Duration) Std

func (d Duration) Std() time.Duration

func (*Duration) UnmarshalYAML

func (d *Duration) UnmarshalYAML(n *yaml.Node) error

type Log

type Log struct {
	Level  string `yaml:"level"`
	Format string `yaml:"format"`
}

Jump to

Keyboard shortcuts

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