• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

jo-hoe / video-to-podcast-service / 21490136194

29 Jan 2026 06:31PM UTC coverage: 18.018% (-0.4%) from 18.433%
21490136194

push

github

johannes
pinning of yt-dlp version and added slog instead of log

10 of 114 new or added lines in 11 files covered. (8.77%)

3 existing lines in 3 files now uncovered.

240 of 1332 relevant lines covered (18.02%)

0.42 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/internal/server/server.go
1
package server
2

3
import (
4
        "fmt"
5
        "log/slog"
6
        "net/http"
7
        "strconv"
8
        "time"
9

10
        "github.com/jo-hoe/video-to-podcast-service/internal/config"
11
        "github.com/jo-hoe/video-to-podcast-service/internal/core"
12
        "github.com/jo-hoe/video-to-podcast-service/internal/core/database"
13
        "github.com/jo-hoe/video-to-podcast-service/internal/server/api"
14
        "github.com/jo-hoe/video-to-podcast-service/internal/server/ui"
15

16
        "github.com/go-playground/validator"
17
        "github.com/labstack/echo/v4"
18
        "github.com/labstack/echo/v4/middleware"
19
)
20

21
var defaultResourcePath string
22

23
func StartServer(databaseService database.DatabaseService, cfg *config.Config) {
×
24
        defaultResourcePath = cfg.Persistence.Media.MediaPath
×
25

×
26
        e := echo.New()
×
27
        // Use RequestLogger with LogValuesFunc to satisfy linter and avoid panic.
×
28
        // Skip logging for probe and health endpoints.
×
29
        e.Use(middleware.RequestLoggerWithConfig(middleware.RequestLoggerConfig{
×
30
                Skipper: func(c echo.Context) bool {
×
31
                        return c.Path() == api.ProbePath || c.Path() == api.HealthPath
×
32
                },
×
33
                LogValuesFunc: func(c echo.Context, v middleware.RequestLoggerValues) error {
×
NEW
34
                        slog.Info("request",
×
NEW
35
                                "time", v.StartTime.Format(time.RFC3339),
×
NEW
36
                                "method", v.Method,
×
NEW
37
                                "uri", v.URI,
×
NEW
38
                                "status", v.Status,
×
NEW
39
                                "latency", v.Latency,
×
NEW
40
                        )
×
41
                        return nil
×
42
                },
×
43
        }))
44
        e.Use(middleware.Recover())
×
45
        e.Pre(middleware.RemoveTrailingSlash())
×
46

×
47
        e.Validator = &genericValidator{Validator: validator.New()}
×
48

×
49
        coreService := core.NewCoreService(databaseService, defaultResourcePath, &cfg.Persistence.Cookies, &cfg.Persistence.Media)
×
50

×
51
        defaultPortStr := strconv.Itoa(cfg.Port)
×
52
        apiService := api.NewAPIService(coreService, defaultPortStr)
×
53
        apiService.SetAPIRoutes(e)
×
54

×
55
        uiService := ui.NewUIService(coreService)
×
56
        uiService.SetUIRoutes(e)
×
57

×
58
        // start server
×
59
        port := strconv.Itoa(cfg.Port)
×
NEW
60
        slog.Info("starting server")
×
NEW
61
        slog.Info(fmt.Sprintf("UI available at http://localhost:%s/%s", port, ui.MainPageName))
×
NEW
62
        slog.Info(fmt.Sprintf("Explore all feeds via API at http://localhost:%s/%s ", port, api.FeedsPath))
×
UNCOV
63
        e.Logger.Fatal(e.Start(fmt.Sprintf(":%s", port)))
×
64
}
65

66
type genericValidator struct {
67
        Validator *validator.Validate
68
}
69

70
func (gv *genericValidator) Validate(i interface{}) error {
×
71
        if err := gv.Validator.Struct(i); err != nil {
×
72
                return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("received invalid request body: %v", err))
×
73
        }
×
74
        return nil
×
75
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc