configs

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Config File Path (Loaded first from env)
	ConfigFilePath string `envconfig:"CONFIG_FILE" default:"configs/mcpizer.yaml"`

	// File-loaded fields (merged)
	SchemaSources []SchemaSource // Loaded from FileConfig

	// Environment-overridable fields
	ListenAddr               string        `envconfig:"LISTEN_ADDR" default:":8080"`
	HTTPClientTimeout        time.Duration `envconfig:"HTTP_CLIENT_TIMEOUT" default:"30s"`
	ShutdownTimeout          time.Duration `envconfig:"SHUTDOWN_TIMEOUT" default:"5s"`
	ServerReadTimeout        time.Duration `envconfig:"SERVER_READ_TIMEOUT" default:"5s"`
	ServerWriteTimeout       time.Duration `envconfig:"SERVER_WRITE_TIMEOUT" default:"10s"`
	ServerIdleTimeout        time.Duration `envconfig:"SERVER_IDLE_TIMEOUT" default:"120s"`
	OtelExporterOtlpEndpoint string        `envconfig:"OTEL_EXPORTER_OTLP_ENDPOINT"`
	OtelExporterOtlpInsecure bool          `envconfig:"OTEL_EXPORTER_OTLP_INSECURE" default:"true"`
	LogLevel                 string        `envconfig:"LOG_LEVEL" default:"info"`
}

Config holds the final application configuration, merged from file and environment variables. Fields are loaded from environment variables with the prefix "MCPIZER_", potentially overriding file settings.

func Load

func Load() (*Config, error)

Load loads configuration first from environment variables (to get file path), then from the specified YAML file, and finally merges/overrides with environment variables again.

func (*Config) ParsedLogLevel

func (c *Config) ParsedLogLevel() slog.Level

ParsedLogLevel returns the slog.Level based on the configured LogLevel string.

type FileConfig

type FileConfig struct {
	SchemaSources []interface{} `yaml:"schema_sources"`
}

FileConfig defines the structure loaded from the YAML configuration file.

type SchemaSource

type SchemaSource struct {
	URL     string            `yaml:"url"`
	Headers map[string]string `yaml:"headers,omitempty"`
	Server  string            `yaml:"server,omitempty"` // For .proto files, the gRPC server endpoint
	Type    string            `yaml:"type,omitempty"`   // Schema type override (e.g., "connect" for Connect-RPC)
	Mode    string            `yaml:"mode,omitempty"`   // Invocation mode (e.g., "http" or "grpc" for Connect-RPC)
}

SchemaSource represents a single schema source with optional headers

Jump to

Keyboard shortcuts

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