Files
Fabian Gasper 9b0b6b1ecf Finished changing structure to modules:
- ntfy
- keyserver
- webhook
- webserver
functional modules.
2026-07-21 09:45:56 +02:00

37 lines
692 B
Go

package keyserver
import (
"context"
"net/http"
"github.com/gorilla/mux"
"varde/internal/middleware"
)
type Config struct {
Enabled bool
KeysDir string
}
type Module struct {
cfg Config
}
func New(cfg Config) *Module {
return &Module{cfg: cfg}
}
func (m *Module) Name() string { return "keyserver" }
func (m *Module) RegisterRoutes(r *mux.Router) {
fs := http.FileServer(http.Dir(m.cfg.KeysDir))
wkd := r.PathPrefix("/.well-known/").Subrouter()
wkd.Use(middleware.NoListing)
wkd.Use(middleware.WKDHeaders)
wkd.PathPrefix("/").Handler(fs)
}
func (m *Module) Start(ctx context.Context) error { return nil }
func (m *Module) Stop(ctx context.Context) error { return nil }