Use api.Route instead of the caHandler.
This commit is contained in:
parent
a6b8e65d69
commit
a93653ea8e
2 changed files with 11 additions and 9 deletions
15
api/api.go
15
api/api.go
|
@ -249,18 +249,21 @@ type FederationResponse struct {
|
|||
}
|
||||
|
||||
// caHandler is the type used to implement the different CA HTTP endpoints.
|
||||
type caHandler struct {
|
||||
Authority Authority
|
||||
type caHandler struct{}
|
||||
|
||||
// Route configures the http request router.
|
||||
func (h *caHandler) Route(r Router) {
|
||||
Route(r)
|
||||
}
|
||||
|
||||
// New creates a new RouterHandler with the CA endpoints.
|
||||
//
|
||||
// Deprecated: Use api.Route(r Router)
|
||||
func New(auth Authority) RouterHandler {
|
||||
return &caHandler{
|
||||
Authority: auth,
|
||||
}
|
||||
return &caHandler{}
|
||||
}
|
||||
|
||||
func (h *caHandler) Route(r Router) {
|
||||
func Route(r Router) {
|
||||
r.MethodFunc("GET", "/version", Version)
|
||||
r.MethodFunc("GET", "/health", Health)
|
||||
r.MethodFunc("GET", "/root/{sha}", Root)
|
||||
|
|
5
ca/ca.go
5
ca/ca.go
|
@ -170,10 +170,9 @@ func (ca *CA) Init(cfg *config.Config) (*CA, error) {
|
|||
insecureHandler := http.Handler(insecureMux)
|
||||
|
||||
// Add regular CA api endpoints in / and /1.0
|
||||
routerHandler := api.New(auth)
|
||||
routerHandler.Route(mux)
|
||||
api.Route(mux)
|
||||
mux.Route("/1.0", func(r chi.Router) {
|
||||
routerHandler.Route(r)
|
||||
api.Route(r)
|
||||
})
|
||||
|
||||
//Add ACME api endpoints in /acme and /1.0/acme
|
||||
|
|
Loading…
Reference in a new issue