config

package
v1.18.1 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadDatabaseConfig added in v1.10.0

func LoadDatabaseConfig() (platformConfig.DatabaseConfig, error)

LoadDatabaseConfig loads the shared platform database config (driver + a resolved DataSource), independent of any service.

Types

type CORSConfig

type CORSConfig struct {
	AllowedOrigins []string `mapstructure:"allowed_origins"`

	AllowedMethods []string `mapstructure:"allowed_methods"`

	AllowedHeaders []string `mapstructure:"allowed_headers"`

	MaxAge int `mapstructure:"max_age" default:"300"`

	AllowCredentials bool `mapstructure:"allow_credentials" default:"false"`
}

func (*CORSConfig) Validate

func (c *CORSConfig) Validate() error

type GRPCConfig added in v1.10.0

type GRPCConfig struct {
	// EnableReflection registers the gRPC server reflection service, which lets
	// clients (grpcurl, grpcui) enumerate services, methods, and message
	// schemas at runtime. Reflection is exposed as a stream RPC and is NOT
	// covered by the unary service-token interceptors, so it is unauthenticated
	// wherever it is on. Keep it off in production (the zero value): it leaks the
	// full API surface of the auth services to anyone who can reach the port.
	// Enabled in development/CI/staging config for debugging.
	EnableReflection bool `mapstructure:"enable_reflection" default:"false"`
}

GRPCConfig holds platform-wide gRPC server settings shared by all services.

type GRPCService

type GRPCService interface {
	GRPCAddr() string
}

type HTTPDefaults

type HTTPDefaults struct {
	ReadTimeout  time.Duration `mapstructure:"read_timeout" default:"30s"`
	WriteTimeout time.Duration `mapstructure:"write_timeout" default:"30s"`
	IdleTimeout  time.Duration `mapstructure:"idle_timeout" default:"60s"`
}

type HTTPService

type HTTPService interface {
	HTTPAddr() string
}

type RuntimeConfig

type RuntimeConfig[T ServiceConfig] struct {
	Platform config
	Service  T
}

func Load

func Load[T ServiceConfig](serviceName string) (*RuntimeConfig[T], error)

func (*RuntimeConfig[T]) GRPCReflectionEnabled added in v1.10.0

func (r *RuntimeConfig[T]) GRPCReflectionEnabled() bool

GRPCReflectionEnabled reports whether gRPC server reflection should be registered. It defaults to false (production-safe) and is opted into by the development/CI/staging environment config. See GRPCConfig.EnableReflection.

func (*RuntimeConfig[T]) GetDatabaseConfig

func (r *RuntimeConfig[T]) GetDatabaseConfig() platformConfig.DatabaseConfig

func (*RuntimeConfig[T]) Validate

func (r *RuntimeConfig[T]) Validate() error

type ServiceConfig

type ServiceConfig interface {
	Validate() error
}

ServiceConfig interface all service configs must implement

Jump to

Keyboard shortcuts

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