Getting tired

This commit is contained in:
cdricms
2025-02-11 11:59:35 +01:00
parent 7872ecce8a
commit 27c17fc33f

View File

@@ -4,6 +4,7 @@ import (
"context"
"fmt"
"net/http"
"os"
"fr.latosa-escrima/core"
"fr.latosa-escrima/core/models"
@@ -43,6 +44,9 @@ func HandleShortcode(w http.ResponseWriter, r *http.Request) {
// Extract the host
host := r.Host
baseURL := fmt.Sprintf("%s://%s", scheme, host)
if os.Getenv("ENVIRONMENT") != "DEV" {
baseURL += "/api"
}
if shortcode.Media != nil {
shortcode.Media.URL = fmt.Sprintf("%s/media/%s/file", baseURL, shortcode.Media.ID)
}