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

pgconfig / api / 20550401068

28 Dec 2025 07:06AM UTC coverage: 31.117% (+1.1%) from 29.972%
20550401068

push

github

web-flow
Seba/fix goreleaser3 (#31)

* feat: replace log with charmbracelet/log and refactor config loading

Switch to charmbracelet/log for better observability and structured logging.
Consolidate configuration loading into a single LoadConfig function that
returns errors instead of calling log.Fatalf, improving testability.

* fix(release): modernize goreleaser config to v2 and add docker links

Upgrade GoReleaser configuration to version 2 syntax and migrate to
dockers_v2 for multi-arch builds. This commit also adds a footer to the
GitHub Release description with instructions on how to pull the generated
Docker images from Docker Hub and GHCR.

Signed-off-by: Sebastian Webber <sebastian@swebber.me>

10 of 27 new or added lines in 3 files covered. (37.04%)

337 of 1083 relevant lines covered (31.12%)

3.86 hits per line

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

0.0
/cmd/api/main.go
1
package main
2

3
import (
4
        "flag"
5
        "fmt"
6
        "os"
7
        "strconv"
8

9
        "github.com/charmbracelet/log"
10

11
        _ "github.com/pgconfig/api/cmd/api/docs" // docs is generated by Swag CLI, you have to import it.
12
        v1 "github.com/pgconfig/api/cmd/api/handlers/v1"
13
        "github.com/pgconfig/api/cmd/api/routes"
14
        "github.com/pgconfig/api/pkg/version"
15
)
16

17
var (
18
        port      int
19
        rulesFile string
20
        docsFile  string
21
)
22

23
func getDefaultPort(envName string) int {
×
24
        defaultPort := 3000
×
25
        val := os.Getenv(envName)
×
26

×
27
        out, err := strconv.Atoi(val)
×
28
        if err != nil {
×
29
                return defaultPort
×
30
        }
×
31

32
        return out
×
33
}
34

NEW
35
func setupArgs() {
×
36
        flag.IntVar(&port, "port", getDefaultPort("PORT"), "Listen port")
×
37
        flag.StringVar(&rulesFile, "rules-file", "./rules.yml", "Rules file")
×
38
        flag.StringVar(&docsFile, "docs-file", "./pg-docs.yml", "Rules file")
×
39
        flag.Parse()
×
40
}
×
41

42
func main() {
×
NEW
43
        setupArgs()
×
NEW
44

×
NEW
45
        if err := v1.LoadConfig(rulesFile, docsFile); err != nil {
×
NEW
46
                log.Fatal("could not load configuration", "err", err)
×
NEW
47
        }
×
48

NEW
49
        log.Info("PGConfig API", "ver", version.Pretty())
×
50

×
51
        app := routes.New()
×
52
        if err := app.Listen(fmt.Sprintf(":%d", port)); err != nil {
×
NEW
53
                log.Errorf("not running API: %v", err)
×
54
        }
×
55
}
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