config

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProviderOIDC   = "oidc"
	ProviderApiKey = "apikey"
)

Variables

This section is empty.

Functions

func ContextExists

func ContextExists(name string) (bool, error)

ContextExists checks if a context exists.

func CreateContext

func CreateContext(name string) error

CreateContext creates a new context.

func GetApiKey

func GetApiKey() string

func GetAuthProviderName

func GetAuthProviderName() string

GetAuthProviderName returns the authentication provider name.

func GetConfigPath

func GetConfigPath(subdirOrFile string) (string, error)

GetConfigPath returns the full path of a config directory or config file.

func GetContext

func GetContext() string

GetContext returns the effective context.

func GetRootCAs

func GetRootCAs() string

GetRootCAs returns certificate authority data.

func GetServer

func GetServer() string

GetServer returns the server address.

func GetServerNameOverride

func GetServerNameOverride() string

GetServerNameOverride retuns

func Init

func Init(flags *pflag.FlagSet) error

Init initializes configuration from config file, flags and environment variables.

func ListContexts

func ListContexts() ([]string, error)

ListContexts lists all contexts.

func SetApiKey

func SetApiKey(apiKey string) error

SetAuthProvider sets the authentication provider.

func SetAuthProvider

func SetAuthProvider(authProvider *AuthProvider) error

SetAuthProvider sets the authentication provider.

func SetCaCert

func SetCaCert(cert string) error

SetCaCert sets the certificate authority data.

func SetCurrentContext

func SetCurrentContext(ctxName string) error

SetCurrentContext sets the current context.

func SetServerAddress

func SetServerAddress(server string) error

SetServerAddress sets the server address.

func SetServerNameOverride

func SetServerNameOverride(name string) error

SetServerNameOverride sets the server name override.

Types

type ApiKeyConfig

type ApiKeyConfig struct {
	ApiKey string `yaml:"api-key,omitempty" mapstructure:"api-key"`
}

ApiKeyConfig is the configuration for the apikey authentication provider.

func GetApiKeyConfig

func GetApiKeyConfig() (*ApiKeyConfig, error)

GetApiKeyConfig returns the apikey configuration.

type AuthProvider

type AuthProvider struct {
	// Name is the type of authentication provider.
	Name string `yaml:"name" mapstructure:"name"`

	// Config is the configuration for the authentication provider.
	Config any `yaml:"config" mapstructure:"config"`
}

AuthProvider is the authentication provider configuration.

func GetAuthProvider

func GetAuthProvider() *AuthProvider

GetAuthProvider returns the authentication provider.

type Config

type Config struct {
	Server             string        `yaml:"server,omitempty" mapstructure:"server"`
	RootCAs            string        `yaml:"certificate-authority-data,omitempty" mapstructure:"certificate-authority-data"`
	ServerNameOverride string        `yaml:"server-name-override,omitempty" mapstructure:"server-name-override"`
	AuthProvider       *AuthProvider `yaml:"auth-provider,omitempty" mapstructure:"auth-provider"`
}

Config represents the persistent configuration.

func GetConfig

func GetConfig() Config

GetConfig returns the persistent config.

type OIDCConfig

type OIDCConfig struct {
	ClientID     string `yaml:"client-id" mapstructure:"client-id"`
	ClientSecret string `yaml:"client-secret,omitempty" mapstructure:"client-secret"`
	IdToken      string `yaml:"id-token" mapstructure:"id-token"`
	RefreshToken string `yaml:"refresh-token,omitempty" mapstructure:"refresh-token"`
	IdpIssuerUrl string `yaml:"idp-issuer-url" mapstructure:"idp-issuer-url"`
}

OIDCConfig is the configuration for the oidc authentication provider.

func GetOIDCConfig

func GetOIDCConfig() (*OIDCConfig, error)

GetOIDCConfig returns the oidc configuration.

Jump to

Keyboard shortcuts

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