config

package
v0.1.13 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package config provides the configuration for opampctl.

Index

Constants

View Source
const (
	// AuthTypeGithub indicates that the user is authenticated using GitHub.
	AuthTypeGithub = "github"
	// AuthTypeBasic indicates that the user is authenticated using basic authentication.
	AuthTypeBasic = "basic"
	// AuthTypeManual indicates that the user is authenticated using a manual method (e.g., bearer token).
	AuthTypeManual = "manual"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth added in v0.1.1

type Auth struct {
	Type       string `json:"type"    mapstructure:"type"    yaml:"type"`
	GithubAuth `json:",inline" mapstructure:",squash" yaml:",inline"`
	BasicAuth  `json:",inline" mapstructure:",squash" yaml:",inline"`
	ManualAuth `json:",inline" mapstructure:",squash" yaml:",inline"`
}

Auth represents the authentication method for a user in the opampctl configuration.

type BasicAuth added in v0.1.1

type BasicAuth struct {
	Username string `json:"username,omitempty" mapstructure:"username,omitempty" yaml:"username,omitempty"`
	Password string `json:"password,omitempty" mapstructure:"password,omitempty" yaml:"password,omitempty"`
}

BasicAuth represents the basic authentication method for a user in the opampctl configuration.

type Cluster added in v0.1.1

type Cluster struct {
	Name           string         `json:"name"           mapstructure:"name"           yaml:"name"`
	OpAMPCommander OpAMPCommander `json:"opampcommander" mapstructure:"opampcommander" yaml:"opampcommander"`
}

Cluster represents a cluster in the opampctl configuration.

type Context added in v0.1.1

type Context struct {
	Name    string `json:"name"    mapstructure:"name"    yaml:"name"`
	Cluster string `json:"cluster" mapstructure:"cluster" yaml:"cluster"`
	User    string `json:"user"    mapstructure:"user"    yaml:"user"`
}

Context represents a context in the opampctl configuration.

type GithubAuth added in v0.1.1

type GithubAuth struct{}

GithubAuth represents the GitHub authentication method for a user in the opampctl configuration.

type GlobalConfig

type GlobalConfig struct {
	// CacheDir is the directory where cached files are stored.
	CacheDir string `json:"cacheDir" mapstructure:"cacheDir" yaml:"cacheDir"`

	CurrentContext string    `json:"currentContext" mapstructure:"currentContext" yaml:"currentContext"`
	Contexts       []Context `json:"contexts"       mapstructure:"contexts"       yaml:"contexts"`
	Users          []User    `json:"users"          mapstructure:"users"          yaml:"users"`
	Clusters       []Cluster `json:"clusters"       mapstructure:"clusters"       yaml:"clusters"`

	// Debugging Configuration
	// This configuration is not serialized to the config file.
	Runtime `json:"-" mapstructure:"-" yaml:"-"`
}

GlobalConfig contains the global configuration for opampctl.

func NewDefaultGlobalConfig added in v0.1.1

func NewDefaultGlobalConfig(homedir string) *GlobalConfig

NewDefaultGlobalConfig creates a new GlobalConfig with default values.

type Log added in v0.1.10

type Log struct {
	Logger *slog.Logger
	Level  slog.Level
	Format string
	Writer io.Writer
}

Log contains the logging configuration for opampctl.

type ManualAuth added in v0.1.1

type ManualAuth struct {
	BearerToken string `json:"bearerToken,omitempty" mapstructure:"bearerToken,omitempty" yaml:"bearerToken,omitempty"`
}

ManualAuth represents the manual authentication method for a user in the opampctl configuration.

type OpAMPCommander added in v0.1.1

type OpAMPCommander struct {
	Endpoint string `json:"endpoint" mapstructure:"endpoint" yaml:"endpoint"`
}

OpAMPCommander represents the OpAMP Commander configuration in the opampctl configuration.

type Runtime added in v0.1.10

type Runtime struct {
	// ConfigFilename is the path to the configuration file.
	ConfigFilename string `json:"-" mapstructure:"-" yaml:"-"`
	// Output is the output writer for the command.
	Output io.Writer `json:"-" mapstructure:"-" yaml:"-"`
	// Log
	Log Log `json:"-" mapstructure:"-" yaml:"-"`
}

Runtime contains runtime configuration that is not serialized to the config file. It's helper to run the command.

type User added in v0.1.1

type User struct {
	Name string `json:"name" mapstructure:"name" yaml:"name"`
	Auth Auth   `json:"auth" mapstructure:"auth" yaml:"auth"`
}

User represents a user in the opampctl configuration.

Jump to

Keyboard shortcuts

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