config

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2026 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OTelProtocolGRPC = "grpc"
	OTelProtocolHTTP = "http"
	// OTelProtocolHTTPProtobuf is the OpenTelemetry specification's name for
	// what Outpost calls "http". Accepted as an alias.
	OTelProtocolHTTPProtobuf = "http/protobuf"

	// OTelExporterNone disables a signal. It is the specification's value and
	// falls through to each provider constructor's no-exporter branch.
	OTelExporterNone = "none"

	OTelExporterOTLP    = "otlp"
	OTelExporterConsole = "console"
	// OTelExporterStdout is an alias for "console".
	OTelExporterStdout = "stdout"
)
View Source
const (
	SupervisorWorkerPublishMQ  = "publishmq"
	SupervisorWorkerDeliveryMQ = "deliverymq"
	SupervisorWorkerLogMQ      = "logmq"
	SupervisorWorkerRetryMQ    = "retrymq"
)

Names of the workers that support restarts, as used in restart_workers and under workers.

View Source
const DefaultWebhookMaxResponseBodyBytes = 131072

DefaultWebhookMaxResponseBodyBytes is the default cap on the destination response body stored on a delivery attempt: 128 KiB.

The attempt log (event + attempt, response body included) is published to the configured message queue, so it must fit that queue's per-message limit. The strictest limits among supported queues are 256 KiB (SQS default queue attribute) and 256 KB (Azure Service Bus standard tier); Pub/Sub (10 MB) and RabbitMQ (16 MiB default) allow far more. We considered deriving the default per queue, but for three of the four the real limit is deployment-side config we can't see (SQS queue attribute, Azure tier, RabbitMQ server setting), so a single conservative value keeps it simple: half the 256 KiB floor, leaving the other half for the event payload and envelope. Webhook responses are typically small acknowledgments, so 128 KiB should be far more than any well-behaved destination returns.

View Source
const (
	Namespace = "Outpost"
)

Variables

View Source
var (
	ErrMismatchedServiceType         = errors.New("config validation error: service type mismatch")
	ErrInvalidServiceType            = errors.New("config validation error: invalid service type")
	ErrMissingRedis                  = errors.New("config validation error: redis configuration is required")
	ErrMissingLogStorage             = errors.New("config validation error: log storage must be provided")
	ErrMissingMQs                    = errors.New("config validation error: message queue configuration is required")
	ErrMissingAESSecret              = errors.New("config validation error: AES encryption secret is required")
	ErrInvalidPortalProxyURL         = errors.New("config validation error: invalid portal proxy url")
	ErrInvalidWebhookProxyURL        = errors.New("config validation error: invalid webhook proxy url")
	ErrInvalidAWSEventBridgeSource   = errors.New("config validation error: invalid aws eventbridge source")
	ErrInvalidDestinationsProxyURL   = errors.New("config validation error: invalid destinations proxy url")
	ErrInvalidPublishProxyURL        = errors.New("config validation error: invalid publish proxy url")
	ErrInvalidDeploymentID           = errors.New("config validation error: deployment_id must contain only alphanumeric characters, hyphens, and underscores (max 64 characters)")
	ErrInvalidRedisPoolSize          = errors.New("config validation error: redis pool_size must be >= 0")
	ErrInvalidPublishMaxRedeliveries = errors.New("config validation error: publish_max_redeliveries must be >= -1")
	ErrInvalidSupervisorLimit        = errors.New("config validation error: invalid supervisor limit")
	ErrInvalidSupervisorWorker       = errors.New("config validation error: invalid supervisor restart worker")
)
View Source
var ErrInvalidOTelExporter = errors.New("config validation error: invalid OpenTelemetry exporter, must be 'otlp', 'console', 'stdout' or 'none'")
View Source
var ErrInvalidOTelProtocol = errors.New("config validation error: invalid OpenTelemetry protocol, must be 'grpc', 'http' or 'http/protobuf'")

SupervisorWorkerKeys lists the workers that support restarts.

Functions

This section is empty.

Types

type AWSSQSConfig

type AWSSQSConfig struct {
	AccessKeyID     string `` /* 202-byte string literal not displayed */
	SecretAccessKey string `` /* 210-byte string literal not displayed */
	Region          string `yaml:"region" env:"AWS_SQS_REGION" desc:"AWS Region for SQS. Required if AWS SQS is the chosen MQ provider." required:"C"`
	Endpoint        string `` /* 150-byte string literal not displayed */
	DeliveryQueue   string `yaml:"delivery_queue" env:"AWS_SQS_DELIVERY_QUEUE" desc:"Name of the SQS queue for delivery events." required:"N"`
	LogQueue        string `yaml:"log_queue" env:"AWS_SQS_LOG_QUEUE" desc:"Name of the SQS queue for log events." required:"N"`
	DeliveryDLQ     string `` /* 175-byte string literal not displayed */
	LogDLQ          string `` /* 155-byte string literal not displayed */
}

func (*AWSSQSConfig) GetProviderType added in v0.3.0

func (c *AWSSQSConfig) GetProviderType() string

func (*AWSSQSConfig) IsConfigured added in v0.3.0

func (c *AWSSQSConfig) IsConfigured() bool

IsConfigured selects SQS on Region alone; keys are optional so IAM-role auth can use the AWS SDK default credential chain.

func (*AWSSQSConfig) ToInfraConfig added in v0.3.0

func (c *AWSSQSConfig) ToInfraConfig(queueType string) *mqinfra.MQInfraConfig

func (*AWSSQSConfig) ToQueueConfig added in v0.3.0

func (c *AWSSQSConfig) ToQueueConfig(ctx context.Context, queueType string) (*mqs.QueueConfig, error)

type AlertConfig

type AlertConfig struct {
	ConsecutiveFailureCount       OptionalString `` /* 322-byte string literal not displayed */
	AutoDisableDestination        bool           `` /* 238-byte string literal not displayed */
	ExhaustedRetriesWindowSeconds OptionalString `` /* 399-byte string literal not displayed */
}

func (*AlertConfig) ToConfig added in v1.0.6

func (c *AlertConfig) ToConfig() (alert.Settings, error)

ToConfig resolves the raw alert config into operational alert.Settings. For the two count fields the rule is: unset (nil) uses the built-in default, an empty string disables that alert dimension, and any other value must parse to a non-negative integer. It returns an error on a non-numeric or out-of-range value so Validate can reject it at startup.

type AzureServiceBusConfig added in v0.3.0

type AzureServiceBusConfig struct {
	// Using AzureSB with ConnectionString will skip infra management
	ConnectionString string `yaml:"connection_string" env:"AZURE_SERVICEBUS_CONNECTION_STRING" desc:"Azure Service Bus connection string" required:"N"`

	TenantID       string `yaml:"tenant_id" env:"AZURE_SERVICEBUS_TENANT_ID" desc:"Azure Active Directory tenant ID" required:"Y"`
	ClientID       string `yaml:"client_id" env:"AZURE_SERVICEBUS_CLIENT_ID" desc:"Service principal client ID" required:"Y"`
	ClientSecret   string `yaml:"client_secret" env:"AZURE_SERVICEBUS_CLIENT_SECRET" desc:"Service principal client secret" required:"Y"`
	SubscriptionID string `yaml:"subscription_id" env:"AZURE_SERVICEBUS_SUBSCRIPTION_ID" desc:"Azure subscription ID" required:"Y"`
	ResourceGroup  string `yaml:"resource_group" env:"AZURE_SERVICEBUS_RESOURCE_GROUP" desc:"Azure resource group name" required:"Y"`
	Namespace      string `yaml:"namespace" env:"AZURE_SERVICEBUS_NAMESPACE" desc:"Azure Service Bus namespace" required:"Y"`

	DeliveryTopic        string `` /* 136-byte string literal not displayed */
	DeliverySubscription string `` /* 161-byte string literal not displayed */
	LogTopic             string `yaml:"log_topic" env:"AZURE_SERVICEBUS_LOG_TOPIC" desc:"Topic name for log queue" required:"N" default:"outpost-log"`
	LogSubscription      string `` /* 141-byte string literal not displayed */

}

func (*AzureServiceBusConfig) GetProviderType added in v0.3.0

func (c *AzureServiceBusConfig) GetProviderType() string

func (*AzureServiceBusConfig) IsConfigured added in v0.3.0

func (c *AzureServiceBusConfig) IsConfigured() bool

func (*AzureServiceBusConfig) ToInfraConfig added in v0.3.0

func (c *AzureServiceBusConfig) ToInfraConfig(queueType string) *mqinfra.MQInfraConfig

func (*AzureServiceBusConfig) ToQueueConfig added in v0.3.0

func (c *AzureServiceBusConfig) ToQueueConfig(ctx context.Context, queueType string) (*mqs.QueueConfig, error)

type ClickHouseConfig

type ClickHouseConfig struct {
	Addr       string `` /* 179-byte string literal not displayed */
	Username   string `yaml:"username" env:"CLICKHOUSE_USERNAME" desc:"Username for ClickHouse authentication." required:"N"`
	Password   string `yaml:"password" env:"CLICKHOUSE_PASSWORD" desc:"Password for ClickHouse authentication." required:"N"`
	Database   string `yaml:"database" env:"CLICKHOUSE_DATABASE" desc:"Database name in ClickHouse to use." required:"N"`
	TLSEnabled bool   `yaml:"tls_enabled" env:"CLICKHOUSE_TLS_ENABLED" desc:"Enable TLS for ClickHouse connection." required:"N"`
}

func (*ClickHouseConfig) ToConfig

type Config

type Config struct {
	Service       string              `` /* 175-byte string literal not displayed */
	LogLevel      string              `` /* 153-byte string literal not displayed */
	OpenTelemetry OpenTelemetryConfig `yaml:"otel"`
	Telemetry     TelemetryConfig     `yaml:"telemetry"`

	// API
	APIPort      int    `yaml:"api_port" env:"API_PORT" desc:"Port number for the API server to listen on." required:"N"`
	APIKey       string `yaml:"api_key" env:"API_KEY" desc:"API key for authenticating requests to the Outpost API." required:"Y"`
	APIJWTSecret string `` /* 147-byte string literal not displayed */
	GinMode      string `` /* 149-byte string literal not displayed */
	PprofEnabled bool   `` /* 261-byte string literal not displayed */

	// Application
	DeploymentID         string   `` /* 206-byte string literal not displayed */
	AESEncryptionSecret  string   `` /* 159-byte string literal not displayed */
	Topics               []string `` /* 163-byte string literal not displayed */
	TopicsAllowWildcards bool     `` /* 261-byte string literal not displayed */
	HTTPUserAgent        string   `` /* 170-byte string literal not displayed */

	// Infrastructure
	Redis       RedisConfig      `yaml:"redis"`
	ClickHouse  ClickHouseConfig `yaml:"clickhouse"`
	PostgresURL string           `` /* 173-byte string literal not displayed */
	MQs         *MQsConfig       `yaml:"mqs"`

	// PublishMQ
	PublishMQ PublishMQConfig `yaml:"publishmq"`

	// Consumers
	PublishMaxConcurrency  int `` /* 155-byte string literal not displayed */
	PublishMaxRedeliveries int `` /* 454-byte string literal not displayed */
	DeliveryMaxConcurrency int `` /* 143-byte string literal not displayed */
	LogMaxConcurrency      int `` /* 138-byte string literal not displayed */

	// Delivery Retry
	RetrySchedule                 []int `` /* 314-byte string literal not displayed */
	RetryIntervalSeconds          int   `` /* 186-byte string literal not displayed */
	RetryMaxLimit                 int   `` /* 182-byte string literal not displayed */
	RetryPollBackoffMs            int   `` /* 709-byte string literal not displayed */
	RetryVisibilityTimeoutSeconds int   `` /* 322-byte string literal not displayed */

	// Event Delivery
	MaxDestinationsPerTenant int `` /* 152-byte string literal not displayed */
	DeliveryTimeoutSeconds   int `` /* 171-byte string literal not displayed */

	// Idempotency
	PublishIdempotencyKeyTTL  int `` /* 255-byte string literal not displayed */
	DeliveryIdempotencyKeyTTL int `` /* 269-byte string literal not displayed */

	// Log batcher configuration
	LogBatchThresholdSeconds int `` /* 190-byte string literal not displayed */
	LogBatchSize             int `` /* 137-byte string literal not displayed */

	DisableTelemetry bool `` /* 218-byte string literal not displayed */

	// Destinations
	Destinations DestinationsConfig `yaml:"destinations"`

	// Portal
	Portal PortalConfig `yaml:"portal"`

	// Alert
	Alert AlertConfig `yaml:"alert"`

	// Supervisor
	Supervisor SupervisorConfig `yaml:"supervisor" envPrefix:"SUPERVISOR_"`

	// Operator Events
	OperatorEvents OperatorEventsConfig `yaml:"operator_events"`

	// ID Generation
	IDGen IDGenConfig `yaml:"idgen"`

	// Retention
	ClickHouseLogRetentionTTLDays int `` /* 150-byte string literal not displayed */
	// contains filtered or unexported fields
}

func LoadWithoutValidation added in v1.2.0

func LoadWithoutValidation(flags Flags) (*Config, error)

LoadWithoutValidation parses config the same way Parse does, but skips validation. It's for tools like `outpost config list` that want to show the resolved configuration even when required fields are missing.

func Parse

func Parse(flags Flags) (*Config, error)

Parse is the main entry point for parsing and validating config

func ParseWithOS

func ParseWithOS(flags Flags, osInterface OSInterface) (*Config, error)

ParseWithOS parses and validates config with a custom OS interface

func ParseWithoutValidation

func ParseWithoutValidation(flags Flags, osInterface OSInterface) (*Config, error)

ParseWithoutValidation parses the config without validation

func (*Config) ConfigFilePath

func (c *Config) ConfigFilePath() string

ConfigFilePath returns the path of the config file that was used

func (*Config) DeprecationWarnings added in v1.1.0

func (c *Config) DeprecationWarnings() []string

DeprecationWarnings returns human-readable warnings for config options that are set but deprecated or ignored, so callers can surface them at startup.

func (*Config) GetPortalConfig

func (c *Config) GetPortalConfig() portal.PortalConfig

GetPortalConfig returns the portal configuration with all necessary fields

func (*Config) GetRetryBackoff added in v0.8.0

func (c *Config) GetRetryBackoff() (backoff.Backoff, int)

GetRetryBackoff returns the configured backoff strategy based on retry configuration

func (*Config) GetRetryPollBackoff added in v1.2.0

func (c *Config) GetRetryPollBackoff() time.Duration

GetRetryPollBackoff returns the maximum time the retry monitor waits between polls while idle. An explicitly configured positive value is honored as-is. Otherwise (0 = auto) it is min(defaultRetryPollBackoff, shortest configured retry delay), so the monitor is always awake by the time the earliest possible retry comes due and the idle interval never adds latency.

func (*Config) GetService

func (c *Config) GetService() (ServiceType, error)

GetService returns ServiceType with error checking

func (*Config) InitDefaults

func (c *Config) InitDefaults()

func (*Config) LogConfigurationSummary added in v0.9.1

func (c *Config) LogConfigurationSummary() []zap.Field

LogConfigurationSummary returns zap fields with configuration summary, masking sensitive data

⚠️ IMPORTANT: When adding new configuration fields, you MUST update this function to include them in the startup logs. This helps with troubleshooting and ensures configuration visibility.

Guidelines:

  • For non-sensitive fields: use zap.String(), zap.Int(), zap.Bool(), etc.
  • For sensitive fields (secrets, passwords, keys): use zap.Bool("field_configured", value != "")
  • For URLs with credentials: use helper functions like maskURL() or maskPostgresURLHost()

See contributing/config.md for detailed guidelines on configuration logging.

func (*Config) MustGetService

func (c *Config) MustGetService() ServiceType

MustGetService returns ServiceType without error checking - panics if called before validation

func (*Config) ToMigratorOpts

func (c *Config) ToMigratorOpts() migrator.MigrationOpts

func (*Config) ToTelemetryApplicationInfo

func (c *Config) ToTelemetryApplicationInfo() telemetry.ApplicationInfo

func (*Config) Validate

func (c *Config) Validate(flags Flags) error

Validate checks if the configuration is valid

type DestinationAWSEventBridgeConfig added in v1.6.0

type DestinationAWSEventBridgeConfig struct {
	Source string `` /* 225-byte string literal not displayed */
}

AWS EventBridge configuration

type DestinationAWSKinesisConfig

type DestinationAWSKinesisConfig struct {
	MetadataInPayload bool `` /* 191-byte string literal not displayed */
}

AWS Kinesis configuration

type DestinationWebhookCompatConfig added in v1.4.0

type DestinationWebhookCompatConfig struct {
	SignatureHeaderName      string          `` /* 191-byte string literal not displayed */
	SignatureContentTemplate string          `` /* 266-byte string literal not displayed */
	SignatureHeaderTemplate  string          `` /* 283-byte string literal not displayed */
	SignatureEncoding        string          `` /* 172-byte string literal not displayed */
	SignatureAlgorithm       string          `` /* 185-byte string literal not displayed */
	SignatureSecretEncoding  string          `` /* 314-byte string literal not displayed */
	SignatureSecretPrefix    string          `` /* 211-byte string literal not displayed */
	Headers                  HeaderTemplates `` /* 351-byte string literal not displayed */
}

DestinationWebhookCompatConfig mirrors the primary signature options. It is enabled by setting SignatureHeaderName; the other signature options then fall back to the same defaults as the primary signature.

type DestinationWebhookConfig

type DestinationWebhookConfig struct {
	// ProxyURL may contain authentication credentials (e.g., http://user:pass@proxy:8080)
	// and should be treated as sensitive.
	// TODO: Implement sensitive value handling - https://github.com/hookdeck/outpost/issues/480
	Mode         string `` /* 215-byte string literal not displayed */
	ProxyURL     string `` /* 314-byte string literal not displayed */
	HeaderPrefix string `` /* 275-byte string literal not displayed */

	// Header name configs. Each is three-state: unset uses the default
	// '<prefix>' + key, an explicit value pins that exact header name, and an
	// empty string disables the header entirely.
	EventIDHeaderName   OptionalString `` /* 285-byte string literal not displayed */
	SignatureHeaderName OptionalString `` /* 289-byte string literal not displayed */
	TimestampHeaderName OptionalString `` /* 289-byte string literal not displayed */
	TopicHeaderName     OptionalString `` /* 241-byte string literal not displayed */

	// Deprecated: replaced by the *_HEADER_NAME configs above. Setting one of
	// these to true still disables the corresponding header (an empty
	// *_HEADER_NAME is the replacement) but logs a deprecation warning. A new
	// *_HEADER_NAME config always takes precedence over the matching flag.
	DisableDefaultEventIDHeader   bool `` /* 266-byte string literal not displayed */
	DisableDefaultSignatureHeader bool `` /* 270-byte string literal not displayed */
	DisableDefaultTimestampHeader bool `` /* 270-byte string literal not displayed */
	DisableDefaultTopicHeader     bool `` /* 222-byte string literal not displayed */

	TimestampFormat string `` /* 221-byte string literal not displayed */

	SignatureContentTemplate string `` /* 215-byte string literal not displayed */
	SignatureHeaderTemplate  string `` /* 188-byte string literal not displayed */
	SignatureEncoding        string `` /* 175-byte string literal not displayed */
	SignatureAlgorithm       string `` /* 192-byte string literal not displayed */
	SignatureSecretEncoding  string `` /* 372-byte string literal not displayed */
	SignatureSecretPrefix    string `` /* 281-byte string literal not displayed */
	SigningSecretTemplate    string `` /* 356-byte string literal not displayed */
	MaxResponseBodyBytes     int    `` /* 440-byte string literal not displayed */

	Compat DestinationWebhookCompatConfig `` /* 143-byte string literal not displayed */
}

Webhook configuration

type DestinationsConfig

type DestinationsConfig struct {
	MetadataPath                string                          `` /* 143-byte string literal not displayed */
	IncludeMillisecondTimestamp bool                            `` /* 237-byte string literal not displayed */
	ProxyURL                    string                          `` /* 429-byte string literal not displayed */
	Webhook                     DestinationWebhookConfig        `yaml:"webhook" desc:"Configuration specific to webhook destinations."`
	AWSKinesis                  DestinationAWSKinesisConfig     `yaml:"aws_kinesis" desc:"Configuration specific to AWS Kinesis destinations."`
	AWSEventBridge              DestinationAWSEventBridgeConfig `yaml:"aws_eventbridge" desc:"Configuration specific to AWS EventBridge destinations."`
}

DestinationsConfig is the main configuration for all destination types

func (*DestinationsConfig) ToConfig

type Flags

type Flags struct {
	Service string
	Config  string // Config file path
	Version bool   // Print version information
}

func ParseFlags

func ParseFlags() Flags

type GCPPubSubConfig

type GCPPubSubConfig struct {
	Project                   string `` /* 138-byte string literal not displayed */
	ServiceAccountCredentials string `` /* 313-byte string literal not displayed */
	DeliveryTopic             string `yaml:"delivery_topic" env:"GCP_PUBSUB_DELIVERY_TOPIC" desc:"Name of the GCP Pub/Sub topic for delivery events." required:"N"`
	DeliverySubscription      string `` /* 145-byte string literal not displayed */
	LogTopic                  string `yaml:"log_topic" env:"GCP_PUBSUB_LOG_TOPIC" desc:"Name of the GCP Pub/Sub topic for log events." required:"N"`
	LogSubscription           string `` /* 130-byte string literal not displayed */
	DeliveryDLQTopic          string `` /* 199-byte string literal not displayed */
	DeliveryDLQSubscription   string `` /* 226-byte string literal not displayed */
	LogDLQTopic               string `` /* 179-byte string literal not displayed */
	LogDLQSubscription        string `` /* 206-byte string literal not displayed */
}

func (*GCPPubSubConfig) GetProviderType added in v0.3.0

func (c *GCPPubSubConfig) GetProviderType() string

func (*GCPPubSubConfig) IsConfigured added in v0.3.0

func (c *GCPPubSubConfig) IsConfigured() bool

func (*GCPPubSubConfig) ToInfraConfig added in v0.3.0

func (c *GCPPubSubConfig) ToInfraConfig(queueType string) *mqinfra.MQInfraConfig

func (*GCPPubSubConfig) ToQueueConfig added in v0.3.0

func (c *GCPPubSubConfig) ToQueueConfig(ctx context.Context, queueType string) (*mqs.QueueConfig, error)

type HeaderTemplates added in v1.4.0

type HeaderTemplates map[string]string

HeaderTemplates is a header name -> value template map. From the environment it is parsed as comma-separated "name=template" pairs, where "\," is a literal comma. From YAML it is a plain map, or the same string form.

func (*HeaderTemplates) UnmarshalText added in v1.4.0

func (h *HeaderTemplates) UnmarshalText(b []byte) error

func (*HeaderTemplates) UnmarshalYAML added in v1.4.0

func (h *HeaderTemplates) UnmarshalYAML(node *yaml.Node) error

type IDGenConfig added in v0.8.0

type IDGenConfig struct {
	Type              string `yaml:"type" env:"IDGEN_TYPE" desc:"ID generation type for all entities: uuidv4, uuidv7, nanoid. Default: uuidv4" required:"N"`
	AttemptPrefix     string `` /* 186-byte string literal not displayed */
	DestinationPrefix string `` /* 198-byte string literal not displayed */
	EventPrefix       string `` /* 180-byte string literal not displayed */
}

IDGenConfig is the configuration for ID generation

type MQConfigAdapter added in v0.3.0

type MQConfigAdapter interface {
	ToInfraConfig(queueType string) *mqinfra.MQInfraConfig
	ToQueueConfig(ctx context.Context, queueType string) (*mqs.QueueConfig, error)
	GetProviderType() string
	IsConfigured() bool
}

type MQsConfig

type MQsConfig struct {
	AWSSQS          AWSSQSConfig          `` /* 131-byte string literal not displayed */
	AzureServiceBus AzureServiceBusConfig `` /* 150-byte string literal not displayed */
	GCPPubSub       GCPPubSubConfig       `` /* 138-byte string literal not displayed */
	RabbitMQ        RabbitMQConfig        `` /* 133-byte string literal not displayed */
	NATS            NATSConfig            `` /* 135-byte string literal not displayed */
	AutoProvision   *bool                 `` /* 273-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*MQsConfig) GetInfraType

func (c *MQsConfig) GetInfraType() string

func (*MQsConfig) ToInfraConfig added in v0.3.0

func (c *MQsConfig) ToInfraConfig(queueType string) *mqinfra.MQInfraConfig

func (*MQsConfig) ToQueueConfig added in v0.3.0

func (c *MQsConfig) ToQueueConfig(ctx context.Context, queueType string) (*mqs.QueueConfig, error)

type NATSConfig added in v1.6.0

type NATSConfig struct {
	ServerURL       string `` /* 168-byte string literal not displayed */
	Stream          string `yaml:"stream" env:"NATS_STREAM" desc:"Name of the JetStream stream to use." required:"N"`
	DeliverySubject string `yaml:"delivery_subject" env:"NATS_DELIVERY_SUBJECT" desc:"Subject for delivery events." required:"N"`
	LogSubject      string `yaml:"log_subject" env:"NATS_LOG_SUBJECT" desc:"Subject for log events." required:"N"`
	DeliveryDLQ     string `` /* 186-byte string literal not displayed */
	LogDLQ          string `` /* 166-byte string literal not displayed */
}

func (*NATSConfig) GetProviderType added in v1.6.0

func (c *NATSConfig) GetProviderType() string

func (*NATSConfig) IsConfigured added in v1.6.0

func (c *NATSConfig) IsConfigured() bool

func (*NATSConfig) ToInfraConfig added in v1.6.0

func (c *NATSConfig) ToInfraConfig(queueType string) *mqinfra.MQInfraConfig

func (*NATSConfig) ToQueueConfig added in v1.6.0

func (c *NATSConfig) ToQueueConfig(ctx context.Context, queueType string) (*mqs.QueueConfig, error)

type OSInterface

type OSInterface interface {
	Getenv(key string) string
	// LookupEnv reports whether the variable is present (ok) in addition to its
	// value, so callers can distinguish "unset" from "set to empty string" —
	// a distinction caarlos0/env does not surface.
	LookupEnv(key string) (string, bool)
	Stat(name string) (os.FileInfo, error)
	ReadFile(name string) ([]byte, error)
	Environ() []string
}

type OpenTelemetryConfig

type OpenTelemetryConfig struct {
	ServiceName string                  `` /* 146-byte string literal not displayed */
	Traces      OpenTelemetryTypeConfig `yaml:"traces" desc:"OpenTelemetry configuration specific to traces."`
	Metrics     OpenTelemetryTypeConfig `yaml:"metrics" desc:"OpenTelemetry configuration specific to metrics."`
	Logs        OpenTelemetryTypeConfig `yaml:"logs" desc:"OpenTelemetry configuration specific to logs."`
}

func (*OpenTelemetryConfig) GetServiceName

func (c *OpenTelemetryConfig) GetServiceName() string

func (*OpenTelemetryConfig) ToConfig

func (*OpenTelemetryConfig) Validate

func (c *OpenTelemetryConfig) Validate() error

type OpenTelemetryTypeConfig

type OpenTelemetryTypeConfig struct {
	Exporter string `` /* 619-byte string literal not displayed */
	Protocol string `` /* 284-byte string literal not displayed */
}

type OperatorEventsAWSSQSConfig added in v0.16.0

type OperatorEventsAWSSQSConfig struct {
	QueueURL        string `yaml:"queue_url" env:"OPERATOR_EVENTS_AWS_SQS_QUEUE_URL" desc:"AWS SQS queue URL for operator events." required:"N"`
	AccessKeyID     string `` /* 132-byte string literal not displayed */
	SecretAccessKey string `` /* 144-byte string literal not displayed */
	Region          string `yaml:"region" env:"OPERATOR_EVENTS_AWS_SQS_REGION" desc:"AWS region for SQS operator events sink." required:"N"`
	Endpoint        string `` /* 152-byte string literal not displayed */
}

type OperatorEventsConfig added in v0.16.0

type OperatorEventsConfig struct {
	Topics    []string                     `` /* 198-byte string literal not displayed */
	HTTP      OperatorEventsHTTPConfig     `yaml:"http"`
	AWSSQS    OperatorEventsAWSSQSConfig   `yaml:"aws_sqs"`
	GCPPubSub OperatorEventsGCPConfig      `yaml:"gcp_pubsub"`
	RabbitMQ  OperatorEventsRabbitMQConfig `yaml:"rabbitmq"`
}

func (*OperatorEventsConfig) ToConfig added in v0.16.0

func (c *OperatorEventsConfig) ToConfig() opevents.Config

type OperatorEventsGCPConfig added in v0.16.0

type OperatorEventsGCPConfig struct {
	ProjectID   string `` /* 130-byte string literal not displayed */
	TopicID     string `yaml:"topic_id" env:"OPERATOR_EVENTS_GCP_PUBSUB_TOPIC_ID" desc:"GCP Pub/Sub topic ID for operator events." required:"N"`
	Credentials string `` /* 154-byte string literal not displayed */
}

type OperatorEventsHTTPConfig added in v0.16.0

type OperatorEventsHTTPConfig struct {
	URL           string `yaml:"url" env:"OPERATOR_EVENTS_HTTP_URL" desc:"URL to POST operator events to." required:"N"`
	SigningSecret string `` /* 139-byte string literal not displayed */
}

type OperatorEventsRabbitMQConfig added in v0.16.0

type OperatorEventsRabbitMQConfig struct {
	ServerURL string `yaml:"server_url" env:"OPERATOR_EVENTS_RABBITMQ_SERVER_URL" desc:"RabbitMQ server URL for operator events sink." required:"N"`
	Exchange  string `yaml:"exchange" env:"OPERATOR_EVENTS_RABBITMQ_EXCHANGE" desc:"RabbitMQ exchange for operator events." required:"N"`
}

type OptionalInt added in v1.6.0

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

OptionalInt is an integer config value that records whether it was set, so an override can tell "unset, inherit" from an explicit value. An empty env var is left unset (caarlos0/env skips it), as is a YAML null.

func NewOptionalInt added in v1.6.0

func NewOptionalInt(value int) OptionalInt

NewOptionalInt returns a set OptionalInt. Intended for tests and programmatic config construction.

func (OptionalInt) Get added in v1.6.0

func (o OptionalInt) Get() (int, bool)

Get returns the value and whether it was set.

func (OptionalInt) Or added in v1.6.0

func (o OptionalInt) Or(fallback int) int

Or returns the value if set, otherwise fallback.

func (*OptionalInt) UnmarshalText added in v1.6.0

func (o *OptionalInt) UnmarshalText(b []byte) error

func (*OptionalInt) UnmarshalYAML added in v1.6.0

func (o *OptionalInt) UnmarshalYAML(node *yaml.Node) error

type OptionalString added in v1.0.6

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

OptionalString is a config value that records whether it was provided at all, distinguishing "unset" from "explicitly set to empty string". This lets a single field express three states — unset, empty, value — which a plain string cannot.

It implements both encoding.TextUnmarshaler (so caarlos0/env binds it as a scalar — avoiding the pointer-recursion crash a *string triggers) and yaml.Unmarshaler (so YAML can express the empty state via `key: ""`).

One gap remains: caarlos0/env ignores a present-but-empty env var entirely and never invokes UnmarshalText for it, so the empty-env case is handled explicitly during parsing via OSInterface.LookupEnv (see captureEmptyEnv).

func NewOptionalString added in v1.0.6

func NewOptionalString(value string) OptionalString

NewOptionalString returns a set OptionalString. Intended for tests and programmatic config construction.

func (OptionalString) Get added in v1.0.6

func (o OptionalString) Get() (string, bool)

Get returns the value and whether it was set.

func (*OptionalString) UnmarshalText added in v1.0.6

func (o *OptionalString) UnmarshalText(b []byte) error

func (*OptionalString) UnmarshalYAML added in v1.0.6

func (o *OptionalString) UnmarshalYAML(node *yaml.Node) error

type PortalConfig

type PortalConfig struct {
	ProxyURL                   string `` /* 197-byte string literal not displayed */
	RefererURL                 string `` /* 210-byte string literal not displayed */
	RefreshURL                 string `` /* 307-byte string literal not displayed */
	FaviconURL                 string `yaml:"favicon_url" env:"PORTAL_FAVICON_URL" desc:"URL for the favicon to be used in the Outpost Portal." required:"N"`
	BrandColor                 string `` /* 195-byte string literal not displayed */
	LogoDark                   string `yaml:"logo_dark" env:"PORTAL_LOGO_DARK" desc:"URL for the dark-mode logo to be displayed in the Outpost Portal." required:"N"`
	OrgName                    string `yaml:"org_name" env:"PORTAL_ORGANIZATION_NAME" desc:"Organization name displayed in the Outpost Portal." required:"N"`
	ForceTheme                 string `` /* 134-byte string literal not displayed */
	DisableOutpostBranding     bool   `` /* 139-byte string literal not displayed */
	EnableDestinationFilter    bool   `` /* 161-byte string literal not displayed */
	EnableWebhookCustomHeaders bool   `` /* 190-byte string literal not displayed */
}

type PublishAWSSQSConfig

type PublishAWSSQSConfig struct {
	AccessKeyID     string `` /* 228-byte string literal not displayed */
	SecretAccessKey string `` /* 236-byte string literal not displayed */
	Region          string `` /* 155-byte string literal not displayed */
	Endpoint        string `` /* 127-byte string literal not displayed */
	Queue           string `` /* 160-byte string literal not displayed */
}

type PublishAzureServiceBusConfig added in v0.4.0

type PublishAzureServiceBusConfig struct {
	ConnectionString string `` /* 217-byte string literal not displayed */
	Topic            string `` /* 193-byte string literal not displayed */
	Subscription     string `` /* 222-byte string literal not displayed */
}

type PublishGCPPubSubConfig

type PublishGCPPubSubConfig struct {
	Project                   string `` /* 172-byte string literal not displayed */
	Topic                     string `` /* 175-byte string literal not displayed */
	Subscription              string `` /* 204-byte string literal not displayed */
	ServiceAccountCredentials string `` /* 281-byte string literal not displayed */
}

type PublishMQConfig

type PublishMQConfig struct {
	AWSSQS          PublishAWSSQSConfig          `` /* 147-byte string literal not displayed */
	AzureServiceBus PublishAzureServiceBusConfig `` /* 166-byte string literal not displayed */
	GCPPubSub       PublishGCPPubSubConfig       `` /* 154-byte string literal not displayed */
	RabbitMQ        PublishRabbitMQConfig        `` /* 149-byte string literal not displayed */
	ProxyURL        string                       `` /* 275-byte string literal not displayed */
}

func (PublishMQConfig) GetInfraType

func (c PublishMQConfig) GetInfraType() string

func (*PublishMQConfig) GetQueueConfig

func (c *PublishMQConfig) GetQueueConfig() *mqs.QueueConfig

func (*PublishMQConfig) ProxyIgnored added in v1.5.0

func (c *PublishMQConfig) ProxyIgnored() bool

ProxyIgnored reports whether a proxy is configured for a provider that connects directly.

func (*PublishMQConfig) Validate added in v1.1.0

func (c *PublishMQConfig) Validate() error

Validate enforces the AWS SQS partial-credential rule for the selected provider and rejects a malformed proxy chain.

type PublishRabbitMQConfig

type PublishRabbitMQConfig struct {
	ServerURL string `` /* 181-byte string literal not displayed */
	Exchange  string `yaml:"exchange" env:"PUBLISH_RABBITMQ_EXCHANGE" desc:"Name of the RabbitMQ exchange for the publish queue." required:"N"`
	Queue     string `` /* 167-byte string literal not displayed */
}

type RabbitMQConfig

type RabbitMQConfig struct {
	ServerURL     string `` /* 186-byte string literal not displayed */
	Exchange      string `yaml:"exchange" env:"RABBITMQ_EXCHANGE" desc:"Name of the RabbitMQ exchange to use." required:"N"`
	DeliveryQueue string `yaml:"delivery_queue" env:"RABBITMQ_DELIVERY_QUEUE" desc:"Name of the RabbitMQ queue for delivery events." required:"N"`
	LogQueue      string `yaml:"log_queue" env:"RABBITMQ_LOG_QUEUE" desc:"Name of the RabbitMQ queue for log events." required:"N"`
	DeliveryDLQ   string `` /* 176-byte string literal not displayed */
	LogDLQ        string `` /* 156-byte string literal not displayed */
}

func (*RabbitMQConfig) GetProviderType added in v0.3.0

func (c *RabbitMQConfig) GetProviderType() string

func (*RabbitMQConfig) IsConfigured added in v0.3.0

func (c *RabbitMQConfig) IsConfigured() bool

func (*RabbitMQConfig) ToInfraConfig added in v0.3.0

func (c *RabbitMQConfig) ToInfraConfig(queueType string) *mqinfra.MQInfraConfig

func (*RabbitMQConfig) ToQueueConfig added in v0.3.0

func (c *RabbitMQConfig) ToQueueConfig(ctx context.Context, queueType string) (*mqs.QueueConfig, error)

type RedisConfig

type RedisConfig struct {
	Host                   string `yaml:"host" env:"REDIS_HOST" desc:"Hostname or IP address of the Redis server." required:"Y"`
	Port                   int    `yaml:"port" env:"REDIS_PORT" desc:"Port number for the Redis server." required:"Y"`
	Username               string `yaml:"username" env:"REDIS_USERNAME" desc:"Username for Redis ACL authentication." required:"N"`
	Password               string `yaml:"password" env:"REDIS_PASSWORD" desc:"Password for Redis authentication, if required by the server." required:"Y"`
	Database               int    `` /* 132-byte string literal not displayed */
	TLSEnabled             bool   `yaml:"tls_enabled" env:"REDIS_TLS_ENABLED" desc:"Enable TLS encryption for Redis connection." required:"N"`
	TLSVerify              bool   `yaml:"tls_verify" env:"REDIS_TLS_VERIFY" desc:"Enable verification of the Redis server's TLS certificate." required:"N"`
	ClusterEnabled         bool   `` /* 131-byte string literal not displayed */
	PoolSize               int    `` /* 172-byte string literal not displayed */
	DevClusterHostOverride bool   `` /* 191-byte string literal not displayed */
}

func (*RedisConfig) ToConfig

func (c *RedisConfig) ToConfig() *redis.RedisConfig

type ServiceType

type ServiceType int
const (
	ServiceTypeAll ServiceType = iota
	ServiceTypeAPI
	ServiceTypeLog
	ServiceTypeDelivery
)

func ServiceTypeFromString

func ServiceTypeFromString(s string) (ServiceType, error)

func (ServiceType) String

func (s ServiceType) String() string

type SupervisorConfig added in v1.6.0

type SupervisorConfig struct {
	RestartWorkers []string                `` /* 263-byte string literal not displayed */
	Startup        SupervisorLimitsConfig  `yaml:"startup" envPrefix:"STARTUP_"`
	Recovery       SupervisorLimitsConfig  `yaml:"recovery" envPrefix:"RECOVERY_"`
	Workers        SupervisorWorkersConfig `yaml:"workers"`
}

SupervisorConfig picks the workers the supervisor restarts when they fail and sets how long it keeps restarting one before /healthz reports it failed. The top-level limits apply to every worker in RestartWorkers; Workers overrides them per worker.

func (*SupervisorConfig) Effective added in v1.6.0

func (c *SupervisorConfig) Effective(key string) (startup, recovery SupervisorLimitsConfig)

Effective returns a worker's limits with unset overrides filled from the globals. key is one of SupervisorWorkerKeys.

func (*SupervisorConfig) RestartEnabled added in v1.6.0

func (c *SupervisorConfig) RestartEnabled(key string) bool

RestartEnabled reports whether the worker named key is in RestartWorkers.

func (*SupervisorConfig) RestartPolicy added in v1.6.0

func (c *SupervisorConfig) RestartPolicy(key string) (worker.RestartPolicy, bool)

RestartPolicy returns the restart policy and whether restarts are enabled for the worker named key, one of SupervisorWorkerKeys.

type SupervisorLimitsConfig added in v1.6.0

type SupervisorLimitsConfig struct {
	MaxAttempts        int `` /* 140-byte string literal not displayed */
	MaxDurationSeconds int `` /* 226-byte string literal not displayed */
}

type SupervisorLimitsOverrideConfig added in v1.6.0

type SupervisorLimitsOverrideConfig struct {
	MaxAttempts        OptionalInt `` /* 128-byte string literal not displayed */
	MaxDurationSeconds OptionalInt `` /* 152-byte string literal not displayed */
}

type SupervisorWorkerConfig added in v1.6.0

type SupervisorWorkerConfig struct {
	Startup  SupervisorLimitsOverrideConfig `yaml:"startup" envPrefix:"STARTUP_"`
	Recovery SupervisorLimitsOverrideConfig `yaml:"recovery" envPrefix:"RECOVERY_"`
}

SupervisorWorkerConfig overrides the global limits for one worker. Unset values inherit the global ones. Ignored unless the worker is in RestartWorkers.

type SupervisorWorkersConfig added in v1.6.0

type SupervisorWorkersConfig struct {
	PublishMQ  SupervisorWorkerConfig `yaml:"publishmq" envPrefix:"PUBLISHMQ_"`
	DeliveryMQ SupervisorWorkerConfig `yaml:"deliverymq" envPrefix:"DELIVERYMQ_"`
	LogMQ      SupervisorWorkerConfig `yaml:"logmq" envPrefix:"LOGMQ_"`
	RetryMQ    SupervisorWorkerConfig `yaml:"retrymq" envPrefix:"RETRYMQ_"`
}

type TelemetryConfig

type TelemetryConfig struct {
	Disabled          bool   `` /* 233-byte string literal not displayed */
	BatchSize         int    `yaml:"batch_size" env:"TELEMETRY_BATCH_SIZE" desc:"Maximum number of telemetry events to batch before sending." required:"N"`
	BatchInterval     int    `` /* 177-byte string literal not displayed */
	HookdeckSourceURL string `` /* 194-byte string literal not displayed */
	SentryDSN         string `` /* 175-byte string literal not displayed */
}

func (*TelemetryConfig) ToTelemetryConfig

func (c *TelemetryConfig) ToTelemetryConfig() telemetry.TelemetryConfig

Jump to

Keyboard shortcuts

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