...
This commit is contained in:
		
							
								
								
									
										59
									
								
								cmd/heroagent/main.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										59
									
								
								cmd/heroagent/main.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,59 @@ | ||||
| // @title HeroLauncher API | ||||
| // @version 1.0 | ||||
| // @description HeroLauncher API provides endpoints for managing services, processes, and system resources | ||||
| // @termsOfService http://swagger.io/terms/ | ||||
|  | ||||
| // @contact.name HeroLauncher Support | ||||
| // @contact.url https://github.com/freeflowuniverse/heroagent | ||||
| // @contact.email support@heroagent.io | ||||
|  | ||||
| // @license.name MIT | ||||
| // @license.url https://opensource.org/licenses/MIT | ||||
|  | ||||
| // @host localhost:9021 | ||||
| // @BasePath / | ||||
| // @schemes http https | ||||
|  | ||||
| // @securityDefinitions.apikey ApiKeyAuth | ||||
| // @in header | ||||
| // @name Authorization | ||||
|  | ||||
| package main | ||||
|  | ||||
| import ( | ||||
| 	"flag" | ||||
| 	"fmt" | ||||
| 	"log" | ||||
| 	"os" | ||||
|  | ||||
| 	"github.com/freeflowuniverse/heroagent/pkg/heroagent" | ||||
| 	_ "github.com/freeflowuniverse/heroagent/pkg/heroagent/docs" // Import generated swagger docs | ||||
| ) | ||||
|  | ||||
| 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) | ||||
| 	} | ||||
| } | ||||
		Reference in New Issue
	
	Block a user