config

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuthName        = "personal-access-token"
	OrgIDGlobalName = "org-id"
)
View Source
const (

	// StreamingFlagName is the name of the --streaming flag.
	StreamingFlagName = "streaming"
)

Variables

View Source
var ErrInvalidBackoffType = errors.New("invalid backoff type")
View Source
var ErrUnsupportedTemplateEntity = fmt.Errorf("unsupported template entity type")

Functions

func BindGlobalFlags

func BindGlobalFlags(persistentFlags *pflag.FlagSet, cfg *Config) error

BindGlobalFlags binds all global configuration flags to viper. This should be called on the root command.

Types

type BackoffType

type BackoffType string
const (
	BackoffFixed       BackoffType = "fixed"
	BackoffExponential BackoffType = "exponential"
	BackoffLinear      BackoffType = "linear"
)

func (BackoffType) String

func (b BackoffType) String() string

func (*BackoffType) UnmarshalText

func (b *BackoffType) UnmarshalText(text []byte) error

type Config

type Config struct {
	OutputFormat  formatter.OutputFormat            `yaml:"output-format" mapstructure:"output-format" doc:"Default output format (json|yaml|tree)"`
	Streaming     bool                              `yaml:"streaming" mapstructure:"streaming" doc:"Enable streaming output mode (NDJSON) for commands that support it"`
	NoColor       bool                              `yaml:"no-color" mapstructure:"no-color" doc:"Disable ANSI colors and styles"`
	Spinner       SpinnerConfig                     `yaml:"spinner" mapstructure:"spinner"`
	Quiet         bool                              `yaml:"quiet" mapstructure:"quiet" doc:"Suppress non-essential output"`
	Debug         bool                              `yaml:"debug" mapstructure:"debug"`
	Timeouts      TimeoutConfig                     `yaml:"timeouts" mapstructure:"timeouts"`
	RetryStrategy RetryStrategy                     `yaml:"retry-strategy" mapstructure:"retry-strategy"`
	Templates     map[TemplateEntity]TemplateConfig `yaml:"templates" mapstructure:"templates"`
	Search        SearchConfig                      `yaml:"search" mapstructure:"search"`
	DefaultTZ     datetime.TimeZone                 `yaml:"default-tz" mapstructure:"default-tz" doc:"Default timezone for timestamps"`
}

func New

func New(dataDir string) (*Config, cenclierrors.CencliError)

func (*Config) GetTemplate

func (c *Config) GetTemplate(entity TemplateEntity) (TemplateConfig, TemplateNotFoundError)

func (*Config) Unmarshal

func (c *Config) Unmarshal() cenclierrors.CencliError

type DefaultTemplateNotFoundError

type DefaultTemplateNotFoundError interface {
	cenclierrors.CencliError
	Entity() string
}

func NewDefaultTemplateNotFoundError

func NewDefaultTemplateNotFoundError(entity string) DefaultTemplateNotFoundError

type InvalidConfigError

type InvalidConfigError interface {
	cenclierrors.CencliError
}

type RetryStrategy

type RetryStrategy struct {
	MaxAttempts uint64        `yaml:"max-attempts" mapstructure:"max-attempts"`
	BaseDelay   time.Duration `yaml:"base-delay" mapstructure:"base-delay"`
	MaxDelay    time.Duration `yaml:"max-delay" mapstructure:"max-delay"`
	Backoff     BackoffType   `yaml:"backoff" mapstructure:"backoff" doc:"Backoff strategy (fixed|linear|exponential)"`
}

type SearchConfig

type SearchConfig struct {
	// PageSize sets the default number of results per page for search.
	// Must be >= 1.
	PageSize int64 `yaml:"page-size" mapstructure:"page-size" doc:"Default number of results per page (must be >= 1)"`
	// MaxPages limits the number of pages fetched. Set to -1 for unlimited.
	// 0 is invalid and will be rejected.
	MaxPages int64 `yaml:"max-pages" mapstructure:"max-pages" doc:"Number of pages to fetch (max is 100)"`
}

SearchConfig contains defaults for search pagination.

type SpinnerConfig added in v0.0.3

type SpinnerConfig struct {
	Disabled                   bool   `yaml:"disabled" mapstructure:"disabled" doc:"Disable spinner during operations"`
	StartStopwatchAfterSeconds uint64 `yaml:"start-stopwatch-after" mapstructure:"start-stopwatch-after" doc:"Show stopwatch in the spinner after this many seconds"`
}

type TemplateConfig

type TemplateConfig struct {
	Path string `yaml:"path" mapstructure:"path" doc:"Path to the template file"`
}

type TemplateDirectoryError

type TemplateDirectoryError interface {
	cenclierrors.CencliError
}

type TemplateEntity

type TemplateEntity string
const (
	TemplateEntityHost         TemplateEntity = "host"
	TemplateEntityCertificate  TemplateEntity = "certificate"
	TemplateEntityWebProperty  TemplateEntity = "webproperty"
	TemplateEntitySearchResult TemplateEntity = "searchresult"
)

func (TemplateEntity) String

func (a TemplateEntity) String() string

func (*TemplateEntity) UnmarshalText

func (a *TemplateEntity) UnmarshalText(text []byte) error

type TemplateNotFoundError

type TemplateNotFoundError interface {
	cenclierrors.CencliError
}

type TemplateNotRegisteredError

type TemplateNotRegisteredError interface {
	cenclierrors.CencliError
}

type TimeoutConfig added in v0.0.3

type TimeoutConfig struct {
	HTTP time.Duration `yaml:"http" mapstructure:"http" doc:"Per-request timeout for HTTP requests (e.g. 10s, 1m). Set to 0 to disable"`
}

Jump to

Keyboard shortcuts

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