config

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDefaultConfigPath

func GetDefaultConfigPath() (string, error)

GetDefaultConfigPath returns the path to the current user's default tctx config file. On unix systems, this will be `$XDG_CONFIG_HOME/tctx/config.json`.

Types

type ClusterConfig

type ClusterConfig struct {
	// host:port for Temporal frontend service
	Address string `json:"address"`
	// Web UI Link
	WebAddress string `json:"webAddress"`
	// Temporal workflow namespace (default: "default")
	Namespace string `json:"namespace"`
	// Headers provider plugin executable name
	HeadersProvider string `json:"headersProvider"`
	// Data converter plugin executable name
	DataConverter string     `json:"dataConverter"`
	TLS           *TLSConfig `json:"tls,omitempty"`
	// Any additional environment variables that are needed
	Environment map[string]string `json:"additional,omitempty"`
}

func (ClusterConfig) GetTLS

func (c ClusterConfig) GetTLS() TLSConfig

type Config

type Config struct {
	ActiveContext string `json:"active"`
	// Map of context names to cluster configuration
	Contexts map[string]*ClusterConfig `json:"contexts"`
}

type ConfigManager

type ConfigManager struct {
	// contains filtered or unexported fields
}

func NewConfigManager

func NewConfigManager(opts ...Option) (*ConfigManager, error)

NewConfigManager returns a new ConfigManager to interact with the tctx config

func (*ConfigManager) DeleteContext

func (t *ConfigManager) DeleteContext(name string) error

DeleteContext deletes the context with given name from the config

func (*ConfigManager) GetActiveContext

func (t *ConfigManager) GetActiveContext() (*ClusterConfig, error)

GetContext returns the ClusterConfig for a the active context

func (*ConfigManager) GetActiveContextName

func (t *ConfigManager) GetActiveContextName() (string, error)

GetContext returns the name of the active context

func (*ConfigManager) GetAllContexts

func (t *ConfigManager) GetAllContexts() (*Config, error)

GetAllContexts returns the ClusterConfig for all configured contexts

func (*ConfigManager) GetContext

func (t *ConfigManager) GetContext(name string) (*ClusterConfig, error)

GetContext returns the ClusterConfig for a given context names

func (*ConfigManager) GetContextNames

func (t *ConfigManager) GetContextNames() ([]string, error)

GetContextNames returns the list of configured context names

func (*ConfigManager) SetActiveContext

func (t *ConfigManager) SetActiveContext(name, namespace string) error

SetActiveContext sets the active context

func (*ConfigManager) UpsertContext

func (t *ConfigManager) UpsertContext(name string, new *ClusterConfig) error

UpsertContext upserts a context into the configuration file

type Option

type Option func(t *ConfigManager)

func WithConfigFile

func WithConfigFile(configFilePath string) Option

WithConfigFile returns the option to set the config file path

type TLSConfig

type TLSConfig struct {
	// Path to x509 certificate
	CertPath string `json:"certPath"`
	// Path to private key
	KeyPath string `json:"keyPath"`
	// Path to server CA certificate
	CACertPath string `json:"caPath"`
	// Disable tls host name verification (tls must be enabled)
	DisableHostVerification bool `json:"disableHostVerification"`
	// Override for target server name
	ServerName string `json:"serverName"`
}

Jump to

Keyboard shortcuts

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