diff options
author | Gabriel A. Giovanini <mail@gabrielgio.me> | 2024-05-26 20:33:37 +0200 |
---|---|---|
committer | Gabriel A. Giovanini <mail@gabrielgio.me> | 2024-05-26 20:33:37 +0200 |
commit | 4534dffb865eb1a50bfbc291a5c3798183081caf (patch) | |
tree | d5bd1a2d9912a6442e3be1511ffb1d99f12287b0 /pkg/handler | |
parent | 349a3d1ff36a436261b1b65b870f8f262f06584f (diff) | |
download | cerrado-4534dffb865eb1a50bfbc291a5c3798183081caf.tar.gz cerrado-4534dffb865eb1a50bfbc291a5c3798183081caf.tar.bz2 cerrado-4534dffb865eb1a50bfbc291a5c3798183081caf.zip |
feat: Add actual git listing implementation
Diffstat (limited to 'pkg/handler')
-rw-r--r-- | pkg/handler/git.go | 9 | ||||
-rw-r--r-- | pkg/handler/status.go | 2 |
2 files changed, 9 insertions, 2 deletions
diff --git a/pkg/handler/git.go b/pkg/handler/git.go index 5b09121..1ed2c49 100644 --- a/pkg/handler/git.go +++ b/pkg/handler/git.go @@ -1,6 +1,7 @@ package handler import ( + "log/slog" "net/http" "git.gabrielgio.me/cerrado/pkg/service" @@ -16,6 +17,12 @@ func NewGitHandler(gitService *service.GitService) *GitHandler { } func (g *GitHandler) List(w http.ResponseWriter, _ *http.Request) { - gitList := &templates.GitListPage{g.gitService.ListRepositories()} + repos, err := g.gitService.ListRepositories() + if err != nil { + slog.Error("Error listing repo", "error", err) + return + } + + gitList := &templates.GitListPage{repos} templates.WritePageTemplate(w, gitList) } diff --git a/pkg/handler/status.go b/pkg/handler/status.go index 2a84a7e..1ca7f70 100644 --- a/pkg/handler/status.go +++ b/pkg/handler/status.go @@ -19,7 +19,7 @@ func ConfigFile(configPath string) func(http.ResponseWriter, *http.Request) { return func(w http.ResponseWriter, _ *http.Request) { f, err := os.Open(configPath) if err != nil { - slog.Error("Error openning config file json", "error", err, "path", configPath) + slog.Error("Error openning config file", "error", err, "path", configPath) return } |