Skip to content

Commit a93653e

Browse files
committed
Use api.Route instead of the caHandler.
1 parent a6b8e65 commit a93653e

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

api/api.go

+9-6
Original file line numberDiff line numberDiff line change
@@ -249,18 +249,21 @@ type FederationResponse struct {
249249
}
250250

251251
// caHandler is the type used to implement the different CA HTTP endpoints.
252-
type caHandler struct {
253-
Authority Authority
252+
type caHandler struct{}
253+
254+
// Route configures the http request router.
255+
func (h *caHandler) Route(r Router) {
256+
Route(r)
254257
}
255258

256259
// New creates a new RouterHandler with the CA endpoints.
260+
//
261+
// Deprecated: Use api.Route(r Router)
257262
func New(auth Authority) RouterHandler {
258-
return &caHandler{
259-
Authority: auth,
260-
}
263+
return &caHandler{}
261264
}
262265

263-
func (h *caHandler) Route(r Router) {
266+
func Route(r Router) {
264267
r.MethodFunc("GET", "/version", Version)
265268
r.MethodFunc("GET", "/health", Health)
266269
r.MethodFunc("GET", "/root/{sha}", Root)

ca/ca.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -170,10 +170,9 @@ func (ca *CA) Init(cfg *config.Config) (*CA, error) {
170170
insecureHandler := http.Handler(insecureMux)
171171

172172
// Add regular CA api endpoints in / and /1.0
173-
routerHandler := api.New(auth)
174-
routerHandler.Route(mux)
173+
api.Route(mux)
175174
mux.Route("/1.0", func(r chi.Router) {
176-
routerHandler.Route(r)
175+
api.Route(r)
177176
})
178177

179178
//Add ACME api endpoints in /acme and /1.0/acme

0 commit comments

Comments
 (0)