heroagent/cmd/heroagent/main.go
2025-05-23 15:28:30 +04:00

39 lines
803 B
Go

package main
import (
"flag"
"fmt"
"log"
"os"
"git.ourworld.tf/herocode/heroagent/pkg/heroagent"
)
func main() {
// Parse command-line flags
portFlag := flag.String("port", "", "Port to run the server on")
flag.Parse()
// Initialize HeroLauncher with default configuration
config := heroagent.DefaultConfig()
// Override with command-line flags if provided
if *portFlag != "" {
config.Port = *portFlag
}
// Override with environment variables if provided
if port := os.Getenv("PORT"); port != "" {
config.Port = port
}
// Create HeroLauncher instance
launcher := heroagent.New(config)
// Start the server
fmt.Printf("Starting HeroLauncher on port %s...\n", config.Port)
if err := launcher.Start(); err != nil {
log.Fatalf("Failed to start HeroLauncher: %v", err)
}
}