make listen interface configurable

This commit is contained in:
ChrisOboe 2025-01-03 11:59:42 +01:00
parent 13f31ddc3f
commit e04f76e695
No known key found for this signature in database

View file

@ -37,6 +37,7 @@ var (
visionLlmProvider = os.Getenv("VISION_LLM_PROVIDER")
visionLlmModel = os.Getenv("VISION_LLM_MODEL")
logLevel = strings.ToLower(os.Getenv("LOG_LEVEL"))
listenInterface = os.Getenv("LISTEN_INTERFACE")
// Templates
titleTemplate *template.Template
@ -200,8 +201,11 @@ func main() {
numWorkers := 1 // Number of workers to start
startWorkerPool(app, numWorkers)
log.Infoln("Server started on port :8080")
if err := router.Run(":8080"); err != nil {
if listenInterface == "" {
listenInterface = ":8080"
}
log.Infoln("Server started on interface", listenInterface)
if err := router.Run(listenInterface); err != nil {
log.Fatalf("Failed to run server: %v", err)
}
}