feat: Add API key middleware and update configuration to support API key validation

This commit is contained in:
2025-03-11 17:20:39 +00:00
parent 165432208c
commit c08da6fc92
5 changed files with 46 additions and 3 deletions
+4
View File
@@ -15,6 +15,7 @@ import (
// Config represents the application configuration
type Config struct {
Database models.DatabaseConfig
APIKey string
}
// LoadConfig loads configuration from environment variables and .env file
@@ -31,6 +32,9 @@ func LoadConfig() (*Config, error) {
return nil, fmt.Errorf("failed to load database config: %w", err)
}
// Load API key
cfg.APIKey = getEnv("API_KEY", "")
return cfg, nil
}