config

package
v0.0.0-...-4527cdf Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package config provides YAML configuration file support for multi-fabric collection.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Global  GlobalConfig   `yaml:"global"`
	Fabrics []FabricConfig `yaml:"fabrics"`
}

Config represents the full YAML configuration file structure.

func LoadConfig

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

LoadConfig reads and parses a YAML configuration file.

func New

func New() Config

New returns a config with default global values.

func ParseConfig

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

ParseConfig reads and parses a YAML configuration file without prompting.

func (*Config) ApplyDefaults

func (c *Config) ApplyDefaults()

ApplyDefaults sets global defaults for missing values.

func (*Config) NormalizeAndPrompt

func (c *Config) NormalizeAndPrompt() error

NormalizeAndPrompt fills missing values and normalizes inputs.

type FabricConfig

type FabricConfig struct {
	Name              string            `yaml:"name"`
	URL               string            `yaml:"url"`
	Output            string            `yaml:"output"`
	Username          string            `yaml:"username"`
	Password          string            `yaml:"password"`
	RequestRetryCount *int              `yaml:"request_retry_count"`
	RetryDelay        *int              `yaml:"retry_delay"`
	BatchSize         *int              `yaml:"batch_size"`
	PageSize          *int              `yaml:"page_size"`
	Confirm           *bool             `yaml:"confirm"`
	Verbose           *bool             `yaml:"verbose"`
	Class             string            `yaml:"class"`
	Query             map[string]string `yaml:"query"`
	SSHPort           *int              `yaml:"ssh_port"`
}

FabricConfig holds per-fabric configuration.

func (*FabricConfig) GetBatchSize

func (f *FabricConfig) GetBatchSize() int

GetBatchSize returns the batch size with fallback to default.

func (*FabricConfig) GetClass

func (f *FabricConfig) GetClass() string

GetClass returns the class with fallback to default.

func (*FabricConfig) GetConfirm

func (f *FabricConfig) GetConfirm() bool

GetConfirm returns the confirm flag with fallback to default.

func (*FabricConfig) GetFabricName

func (f *FabricConfig) GetFabricName() string

GetFabricName returns the display name for a fabric (name if set, otherwise url).

func (*FabricConfig) GetOutputFileName

func (f *FabricConfig) GetOutputFileName() string

GetOutputFileName returns the output filename for a fabric.

func (*FabricConfig) GetPageSize

func (f *FabricConfig) GetPageSize() int

GetPageSize returns the page size with fallback to default.

func (*FabricConfig) GetRequestRetryCount

func (f *FabricConfig) GetRequestRetryCount() int

GetRequestRetryCount returns the request retry count with fallback to default.

func (*FabricConfig) GetRetryDelay

func (f *FabricConfig) GetRetryDelay() int

GetRetryDelay returns the retry delay with fallback to default.

func (*FabricConfig) GetSSHPort

func (f *FabricConfig) GetSSHPort() int

GetSSHPort returns the SSH port with fallback to default (22).

func (*FabricConfig) GetVerbose

func (f *FabricConfig) GetVerbose() bool

GetVerbose returns the verbose flag with fallback to default.

func (*FabricConfig) MergeWithGlobal

func (f *FabricConfig) MergeWithGlobal(global GlobalConfig) FabricConfig

MergeWithGlobal applies global settings to a fabric config, with fabric settings taking precedence.

type GlobalConfig

type GlobalConfig struct {
	Username          string            `yaml:"username"`
	Password          string            `yaml:"password"`
	RequestRetryCount int               `yaml:"request_retry_count"`
	RetryDelay        int               `yaml:"retry_delay"`
	BatchSize         int               `yaml:"batch_size"`
	PageSize          int               `yaml:"page_size"`
	Confirm           bool              `yaml:"confirm"`
	Verbose           bool              `yaml:"verbose"`
	Class             string            `yaml:"class"`
	Query             map[string]string `yaml:"query"`
	SSHPort           int               `yaml:"ssh_port"`
}

GlobalConfig holds global settings that apply to all fabrics.

Jump to

Keyboard shortcuts

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