mirror of
https://github.com/Dvorinka/Trackeep.git
synced 2026-06-04 20:42:59 +00:00
uppdate
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
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",
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user