// Package config handles application configuration from environment variables. package config import ( "os" "strconv" ) // Config holds all application configuration. type Config struct { Port string DatabaseURL string Environment string } // Load reads configuration from environment variables with sensible defaults. func Load() *Config { return &Config{ Port: getEnv("PORT", "8080"), DatabaseURL: getEnv("DATABASE_URL", "postgres://flowreader:flowreader@db:5432/flowreader?sslmode=disable"), Environment: getEnv("ENV", "development"), } } // getEnv returns the value of an environment variable or a default value. func getEnv(key, defaultValue string) string { if value, exists := os.LookupEnv(key); exists { return value } return defaultValue } // getEnvInt returns an integer environment variable or a default value. func getEnvInt(key string, defaultValue int) int { if value, exists := os.LookupEnv(key); exists { if intValue, err := strconv.Atoi(value); err == nil { return intValue } } return defaultValue }