renaming to llama-swap

This commit is contained in:
Benson Wong
2024-10-04 20:21:11 -07:00
parent ef8d0020f3
commit ef05c05f9c
4 changed files with 4 additions and 4 deletions

33
llama-swap.go Normal file
View File

@@ -0,0 +1,33 @@
package main
import (
"flag"
"fmt"
"net/http"
"os"
"github.com/mostlygeek/llama-swap/proxy"
)
func main() {
// Define a command-line flag for the port
configPath := flag.String("config", "config.yaml", "config file name")
listenStr := flag.String("listen", ":8080", "listen ip/port")
flag.Parse() // Parse the command-line flags
config, err := proxy.LoadConfig(*configPath)
if err != nil {
fmt.Printf("Error loading config: %v\n", err)
os.Exit(1)
}
proxyManager := proxy.New(config)
http.HandleFunc("/", proxyManager.HandleFunc)
fmt.Println("llamagate listening on " + *listenStr)
if err := http.ListenAndServe(*listenStr, nil); err != nil {
fmt.Printf("Error starting server: %v\n", err)
os.Exit(1)
}
}