Files
Tomas Dvorak 55d0284b2a uppdate
2026-02-24 10:33:08 +01:00

33 lines
502 B
Go

package handlers
import (
"fmt"
"net/http"
"os"
"github.com/gin-gonic/gin"
)
func GetAPIConfig(c *gin.Context) {
scheme := "http"
if c.Request.TLS != nil {
scheme = "https"
}
host := c.Request.Host
if host == "" {
host = os.Getenv("HOST")
if host == "" {
host = "localhost:8080"
}
}
apiURL := fmt.Sprintf("%s://%s/api/v1", scheme, host)
c.JSON(http.StatusOK, gin.H{
"api_url": apiURL,
"demo_mode": os.Getenv("VITE_DEMO_MODE") == "true",
"version": "1.0.0",
})
}