config

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2026 License: Apache-2.0 Imports: 7 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 the krci CLI. It uses Viper for layered config: flags > env vars > config file > defaults.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BindFlags

func BindFlags(cmd *cobra.Command)

BindFlags registers persistent flags on the root command and binds them to Viper.

func DefaultConfigDir

func DefaultConfigDir() string

DefaultConfigDir returns ~/.config/krci.

func Init

func Init()

Init sets up Viper defaults and reads the config file. Call this early — before Cobra parses flags.

func Save

func Save(cfg *Config) error

Save persists resolved configuration values to the config file. Non-empty values (including those resolved from env vars) are written so they survive across sessions without requiring env vars again.

Types

type Config

type Config struct {
	IssuerURL      string `mapstructure:"issuer-url"`
	ClientID       string `mapstructure:"client-id"`
	Scopes         string `mapstructure:"scopes"`
	PortalURL      string `mapstructure:"portal-url"`
	ClusterName    string `mapstructure:"cluster-name"`
	Namespace      string `mapstructure:"namespace"`
	TokenPath      string
	KeyringService string
	ConfigDir      string
}

Config holds all resolved configuration values.

func Resolve

func Resolve() (*Config, error)

Resolve reads the merged config AFTER Cobra has parsed flags. Call this from PersistentPreRunE so flags are available.

Jump to

Keyboard shortcuts

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