diff --git a/backend/cmd/server/main.go b/backend/cmd/server/main.go index f5bb1a3..ae039d2 100644 --- a/backend/cmd/server/main.go +++ b/backend/cmd/server/main.go @@ -80,6 +80,7 @@ func main() { downloadHandler := downloads.NewHandler(galleryRepository, mediaRepository, objectStorage, authService, downloadService) devHandler := devtools.NewHandler(database, objectStorage, authService, devtools.Config{ DBDriver: cfg.DBDriver, + APIURL: cfg.APIURL, StorageEndpoint: cfg.StorageEndpoint, StorageBucket: cfg.StorageBucket, StorageUseSSL: cfg.StorageUseSSL, @@ -113,7 +114,11 @@ func main() { } go func() { - log.Printf("API listening on http://localhost%s", server.Addr) + addr := cfg.APIURL + if addr == "" { + addr = "http://localhost" + server.Addr + } + log.Printf("API listening on %s", addr) if err := server.ListenAndServe(); err != nil && err != http.ErrServerClosed { log.Fatalf("server failed: %v", err) } diff --git a/backend/internal/dev/handler.go b/backend/internal/dev/handler.go index beeb8e8..e50aebb 100644 --- a/backend/internal/dev/handler.go +++ b/backend/internal/dev/handler.go @@ -17,6 +17,7 @@ import ( type Config struct { DBDriver string + APIURL string StorageEndpoint string StorageBucket string StorageUseSSL bool @@ -67,6 +68,7 @@ func (h *Handler) Diagnostics(c *gin.Context) { writeJSON(c, http.StatusOK, map[string]any{ "environment": "development", "now": time.Now().UTC().Format(time.RFC3339), + "url": h.config.APIURL, "user": map[string]string{ "id": user.ID.String(), "email": user.Email,