diff options
| author | mo khan <mo@mokhan.ca> | 2025-04-21 12:00:16 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2025-04-21 12:00:16 -0600 |
| commit | 2854b695a0df016ef1a9c67303c15911b0ed4b72 (patch) | |
| tree | 80d492014012b4b6d4e8e99fc30f0ee8afc43e51 /app/app.go | |
| parent | 49a8ef7441ac9355a7a8e4890f0a1c9004571f37 (diff) | |
refactor: provide the root dir as a parameter
Diffstat (limited to 'app/app.go')
| -rw-r--r-- | app/app.go | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -2,6 +2,7 @@ package app import ( "net/http" + "path/filepath" "github.com/rs/zerolog" "github.com/xlgmokha/x/pkg/ioc" @@ -15,7 +16,7 @@ import ( "gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/pkg/web/middleware" ) -func New() http.Handler { +func New(rootDir string) http.Handler { mux := ioc.MustResolve[*http.ServeMux](ioc.Default) mountable := []web.Mountable{ @@ -28,7 +29,8 @@ func New() http.Handler { m.MountTo(mux) } - mux.Handle("GET /", http.FileServer(http.Dir("public"))) + dir := http.Dir(filepath.Join(rootDir, "public")) + mux.Handle("GET /", http.FileServer(dir)) logger := ioc.MustResolve[*zerolog.Logger](ioc.Default) oidc := ioc.MustResolve[*oidc.OpenID](ioc.Default) |
