config

package module
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: May 6, 2026 License: MPL-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package config handles client configuration.

Index

Constants

View Source
const (
	CORTEXCLOUD_API_URL_ENV_VAR                = "CORTEXCLOUD_API_URL"
	CORTEXCLOUD_API_KEY_ENV_VAR                = "CORTEXCLOUD_API_KEY"
	CORTEXCLOUD_API_KEY_ID_ENV_VAR             = "CORTEXCLOUD_API_KEY_ID"
	CORTEXCLOUD_API_KEY_TYPE_ENV_VAR           = "CORTEXCLOUD_API_KEY_TYPE"
	CORTEXCLOUD_HEADERS_ENV_VAR                = "CORTEXCLOUD_HEADERS"
	CORTEXCLOUD_AGENT_ENV_VAR                  = "CORTEXCLOUD_AGENT"
	CORTEXCLOUD_SKIP_SSL_VERIFY_ENV_VAR        = "CORTEXCLOUD_SKIP_SSL_VERIFY"
	CORTEXCLOUD_CONFIG_FILE_ENV_VAR            = "CORTEXCLOUD_CONFIG_FILE"
	CORTEXCLOUD_TIMEOUT_ENV_VAR                = "CORTEXCLOUD_TIMEOUT"
	CORTEXCLOUD_MAX_RETRIES_ENV_VAR            = "CORTEXCLOUD_MAX_RETRIES"
	CORTEXCLOUD_RETRY_MAX_DELAY_ENV_VAR        = "CORTEXCLOUD_RETRY_MAX_DELAY"
	CORTEXCLOUD_CRASH_STACK_DIR_ENV_VAR        = "CORTEXCLOUD_CRASH_STACK_DIR"
	CORTEXCLOUD_LOG_LEVEL_ENV_VAR              = "CORTEXCLOUD_LOG_LEVEL"
	CORTEXCLOUD_SKIP_LOGGING_TRANSPORT_ENV_VAR = "CORTEXCLOUD_SKIP_LOGGING_TRANSPORT"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

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

func NewConfig

func NewConfig(opts ...Option) *Config

func NewConfigFromFile

func NewConfigFromFile(filepath string) (*Config, error)

func (*Config) Agent

func (c *Config) Agent() string

Agent returns the user agent.

func (*Config) CortexAPIKey

func (c *Config) CortexAPIKey() string

CortexAPIKey returns the Cortex API key.

func (*Config) CortexAPIKeyID

func (c *Config) CortexAPIKeyID() int

CortexAPIKeyID returns the Cortex API key ID.

func (*Config) CortexAPIKeyType

func (c *Config) CortexAPIKeyType() string

CortexAPIKeyType returns the Cortex API key type.

func (*Config) CortexAPIURL

func (c *Config) CortexAPIURL() string

CortexAPIURL returns the API URL for the Cortex.

func (*Config) CrashStackDir

func (c *Config) CrashStackDir() string

CrashStackDir returns the crash stack directory.

func (*Config) GetOptions

func (c *Config) GetOptions() []Option

func (*Config) Headers

func (c *Config) Headers() map[string]string

Headers returns the HTTP headers.

func (*Config) LogLevel

func (c *Config) LogLevel() string

LogLevel returns the log level.

func (*Config) Logger

func (c *Config) Logger() cortexLog.Logger

Logger returns the logger.

func (*Config) MaxRetries

func (c *Config) MaxRetries() int

MaxRetries returns the maximum number of retries.

func (*Config) RetryMaxDelay

func (c *Config) RetryMaxDelay() int

RetryMaxDelay returns the maximum retry delay.

func (*Config) SetDefaults

func (c *Config) SetDefaults()

SetDefaults sets default values for the configuration.

func (*Config) SkipLoggingTransport

func (c *Config) SkipLoggingTransport() bool

SkipLoggingTransport returns whether to skip logging transport.

func (*Config) SkipSSLVerify

func (c *Config) SkipSSLVerify() bool

SkipSSLVerify returns whether to skip TLS certificate verification.

func (*Config) Timeout

func (c *Config) Timeout() int

Timeout returns the HTTP timeout.

func (*Config) Transport

func (c *Config) Transport() *http.Transport

Transport returns the HTTP transport.

func (*Config) UnmarshalJSON added in v1.0.4

func (c *Config) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals the provided byte array into the calling Config struct.

func (Config) Validate

func (c Config) Validate() error

type Option

type Option func(*Config)

func WithAgent

func WithAgent(agent string) Option

WithAgent returns an Option that sets the Agent field.

func WithCortexAPIKey

func WithCortexAPIKey(apiKey string) Option

WithCortexAPIKey returns an Option that sets the CortexAPIKey field.

func WithCortexAPIKeyID

func WithCortexAPIKeyID(apiKeyID int) Option

WithCortexAPIKeyID returns an Option that sets the CortexAPIKeyID field.

func WithCortexAPIKeyType

func WithCortexAPIKeyType(keyType string) Option

WithCortexAPIKeyType returns an Option that sets the CortexAPIKeyType field.

func WithCortexAPIURL

func WithCortexAPIURL(apiURL string) Option

WithCortexAPIURL returns an Option that sets the CortexAPIURL field.

func WithCrashStackDir

func WithCrashStackDir(dir string) Option

WithCrashStackDir returns an Option that sets the CrashStackDir field.

func WithHeaders

func WithHeaders(headers map[string]string) Option

WithHeaders returns an Option that sets or adds to the Headers map.

func WithLogLevel

func WithLogLevel(level string) Option

WithLogLevel returns an Option that sets the LogLevel field.

func WithLogger

func WithLogger(l sdkLog.Logger) Option

WithLogger returns an Option that sets the Logger field.

func WithMaxRetries

func WithMaxRetries(retries int) Option

WithMaxRetries returns an Option that sets the MaxRetries field.

func WithRetryMaxDelay

func WithRetryMaxDelay(delay int) Option

WithRetryMaxDelay returns an Option that sets the RetryMaxDelay field (in seconds).

func WithSkipLoggingTransport

func WithSkipLoggingTransport(skip bool) Option

WithSkipLoggingTransport returns an Option that sets the SkipLoggingTransport field.

func WithSkipSSLVerify

func WithSkipSSLVerify(skip bool) Option

WithSkipSSLVerify returns an Option that sets the SkipSSLVerify field.

func WithTimeout

func WithTimeout(timeout int) Option

WithTimeout returns an Option that sets the Timeout field (in seconds).

func WithTransport

func WithTransport(transport *http.Transport) Option

WithTransport returns an Option that sets the Transport field.

Jump to

Keyboard shortcuts

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