config

package
v0.0.0-...-e406fe1 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2024 License: MIT Imports: 6 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 {
	Server    server.Config
	Database  database.Config
	Security  SecurityConfig
	RateLimit RateLimitConfig
}

Config represents the complete application configuration

func New

func New() (*Config, error)

New creates a new Config with default values

type RateLimitConfig

type RateLimitConfig struct {
	Enabled    bool          `envconfig:"RATE_LIMIT_ENABLED" default:"true"`
	Rate       int           `envconfig:"RATE_LIMIT_RATE" default:"100"`
	Burst      int           `envconfig:"RATE_LIMIT_BURST" default:"5"`
	TimeWindow time.Duration `envconfig:"RATE_LIMIT_TIME_WINDOW" default:"1m"`
	PerIP      bool          `envconfig:"RATE_LIMIT_PER_IP" default:"true"`
}

RateLimitConfig contains rate limiting settings

type SecurityConfig

type SecurityConfig struct {
	CorsAllowedOrigins   []string      `envconfig:"SECURITY_CORS_ALLOWED_ORIGINS" default:"http://localhost:3000"`
	CorsAllowedMethods   []string      `envconfig:"SECURITY_CORS_ALLOWED_METHODS" default:"GET,POST,PUT,DELETE,OPTIONS"`
	CorsAllowedHeaders   []string      `envconfig:"SECURITY_CORS_ALLOWED_HEADERS" default:"Origin,Content-Type,Accept,Authorization"`
	CorsMaxAge           int           `envconfig:"SECURITY_CORS_MAX_AGE" default:"3600"`
	CorsAllowCredentials bool          `envconfig:"SECURITY_CORS_ALLOW_CREDENTIALS" default:"true"`
	RequestTimeout       time.Duration `envconfig:"SECURITY_REQUEST_TIMEOUT" default:"30s"`
}

SecurityConfig contains security-related settings

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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