package main import ( "os" "git.secnex.io/secnex/masterlog" "git.secnex.io/secnex/pgproxy/config" "git.secnex.io/secnex/pgproxy/proxy" "git.secnex.io/secnex/pgproxy/utils" ) func main() { pseudonymizer := masterlog.NewPseudonymizerFromString("1234567890") masterlog.SetPseudonymizer(pseudonymizer) masterlog.AddSensitiveFields("password") // Load configuration configPath := utils.GetEnv("CONFIG_PATH", "config.yaml") if len(os.Args) > 1 { configPath = os.Args[1] } config, err := config.LoadConfig(configPath) if err != nil { masterlog.Error("Failed to load configuration", map[string]interface{}{"error": err}) os.Exit(1) } masterlog.Info("Loaded configuration", map[string]interface{}{"configPath": configPath, "mappings": len(config.Mappings)}) if config.Debug { masterlog.SetLevel(masterlog.LevelDebug) } else { masterlog.SetLevel(masterlog.LevelInfo) } // Create proxy proxy, err := proxy.NewProxy(config) if err != nil { masterlog.Error("Failed to create proxy", map[string]interface{}{"error": err}) os.Exit(1) } // Start the proxy if err := proxy.Start(); err != nil { masterlog.Error("Proxy error", map[string]interface{}{"error": err}) os.Exit(1) } }