feat: initial gateway implementation

This commit is contained in:
2025-10-19 21:54:14 +02:00
commit 5e1c39b0bf
10 changed files with 2223 additions and 0 deletions

39
pkg/config/config.go Normal file
View File

@@ -0,0 +1,39 @@
package config
import (
"os"
log "github.com/sirupsen/logrus"
)
// Config holds application configuration
type Config struct {
HTTPPort string
UDPPort string
LogLevel string
}
// Load loads configuration from file or environment variables
func Load(configFile string) *Config {
cfg := &Config{
HTTPPort: getEnvOrDefault("HTTP_PORT", "3001"),
UDPPort: getEnvOrDefault("UDP_PORT", "4210"),
LogLevel: getEnvOrDefault("LOG_LEVEL", "info"),
}
// TODO: Load from config file if provided
if configFile != "" {
log.WithField("file", configFile).Info("Loading configuration from file")
// Implement file loading here if needed
}
return cfg
}
// getEnvOrDefault returns environment variable value or default
func getEnvOrDefault(key, defaultValue string) string {
if value := os.Getenv(key); value != "" {
return value
}
return defaultValue
}