config

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CORSConfig

type CORSConfig struct {
	AllowedOrigins string `mapstructure:"CORS_ALLOWED_ORIGINS"`
	AllowedMethods string `mapstructure:"CORS_ALLOWED_METHODS"`
	AllowedHeaders string `mapstructure:"CORS_ALLOWED_HEADERS"`
}

CORSConfig contains CORS configuration

type Config

type Config struct {
	Environment string          `mapstructure:"ENVIRONMENT"`
	LogLevel    string          `mapstructure:"LOG_LEVEL"`
	MongoDB     MongoDBConfig   `mapstructure:",squash"`
	Redis       RedisConfig     `mapstructure:",squash"`
	RabbitMQ    RabbitMQConfig  `mapstructure:",squash"`
	JWT         JWTConfig       `mapstructure:",squash"`
	SMTP        SMTPConfig      `mapstructure:",squash"`
	OAuth       OAuthConfig     `mapstructure:",squash"`
	RateLimit   RateLimitConfig `mapstructure:",squash"`
	CORS        CORSConfig      `mapstructure:",squash"`
}

Config holds all configuration for the application

func Load

func Load() (*Config, error)

Load loads configuration from environment variables and .env file

func LoadConfig

func LoadConfig() (*Config, error)

LoadConfig loads configuration from environment variables and .env file

type JWTConfig

type JWTConfig struct {
	Secret            string `mapstructure:"JWT_SECRET"`
	Expiration        int    `mapstructure:"JWT_EXPIRATION"`
	RefreshExpiration int    `mapstructure:"JWT_REFRESH_EXPIRATION"`
}

JWTConfig contains JWT configuration

type MongoDBConfig

type MongoDBConfig struct {
	URI         string `mapstructure:"MONGODB_URI"`
	Database    string `mapstructure:"MONGODB_DATABASE"`
	MaxPoolSize uint64 `mapstructure:"MONGODB_MAX_POOL_SIZE"`
	MinPoolSize uint64 `mapstructure:"MONGODB_MIN_POOL_SIZE"`
}

MongoDBConfig contains MongoDB configuration

type OAuthConfig

type OAuthConfig struct {
	GoogleClientID     string `mapstructure:"GOOGLE_CLIENT_ID"`
	GoogleClientSecret string `mapstructure:"GOOGLE_CLIENT_SECRET"`
	GoogleRedirectURL  string `mapstructure:"GOOGLE_REDIRECT_URL"`
	GitHubClientID     string `mapstructure:"GITHUB_CLIENT_ID"`
	GitHubClientSecret string `mapstructure:"GITHUB_CLIENT_SECRET"`
	GitHubRedirectURL  string `mapstructure:"GITHUB_REDIRECT_URL"`
}

OAuthConfig contains OAuth configuration

type RabbitMQConfig

type RabbitMQConfig struct {
	URL         string `mapstructure:"RABBITMQ_URL"`
	Exchange    string `mapstructure:"RABBITMQ_EXCHANGE"`
	QueuePrefix string `mapstructure:"RABBITMQ_QUEUE_PREFIX"`
}

RabbitMQConfig contains RabbitMQ configuration

type RateLimitConfig

type RateLimitConfig struct {
	RequestsPerSecond float64 `mapstructure:"RATE_LIMIT_REQUESTS_PER_SECOND"`
	Burst             int     `mapstructure:"RATE_LIMIT_BURST"`
}

RateLimitConfig contains rate limiting configuration

type RedisConfig

type RedisConfig struct {
	Host     string `mapstructure:"REDIS_HOST"`
	Port     string `mapstructure:"REDIS_PORT"`
	Password string `mapstructure:"REDIS_PASSWORD"`
	DB       int    `mapstructure:"REDIS_DB"`
}

RedisConfig contains Redis configuration

func (*RedisConfig) GetRedisAddr

func (c *RedisConfig) GetRedisAddr() string

GetRedisAddr returns the full Redis address

type SMTPConfig

type SMTPConfig struct {
	Host      string `mapstructure:"SMTP_HOST"`
	Port      int    `mapstructure:"SMTP_PORT"`
	Username  string `mapstructure:"SMTP_USERNAME"`
	Password  string `mapstructure:"SMTP_PASSWORD"`
	FromEmail string `mapstructure:"SMTP_FROM_EMAIL"`
	FromName  string `mapstructure:"SMTP_FROM_NAME"`
}

SMTPConfig contains SMTP configuration

Jump to

Keyboard shortcuts

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