Skip to content

Commit

Permalink
new gocertrouter
Browse files Browse the repository at this point in the history
  • Loading branch information
kayra1 committed Apr 18, 2024
1 parent db9e3bf commit 22b6173
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions internal/api/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import (
"strings"
)

// GoCertRouter takes in an environment struct, passes it along to any handlers that will need
// NewGoCertRouter takes in an environment struct, passes it along to any handlers that will need
// access to it, then builds and returns it for a server to consume
func GoCertRouter(env *Environment) http.Handler {
func NewGoCertRouter(env *Environment) http.Handler {
router := http.NewServeMux()
router.HandleFunc("GET /certificate_requests", GetCertificateRequests(env))
router.HandleFunc("POST /certificate_requests", PostCertificateRequest(env))
Expand Down
2 changes: 1 addition & 1 deletion internal/api/handlers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func TestGoCertRouter(t *testing.T) {
}
env := &server.Environment{}
env.DB = testdb
ts := httptest.NewTLSServer(server.GoCertRouter(env))
ts := httptest.NewTLSServer(server.NewGoCertRouter(env))
defer ts.Close()

client := ts.Client()
Expand Down
2 changes: 1 addition & 1 deletion internal/api/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func NewServer(configFile string) (*http.Server, error) {

env := &Environment{}
env.DB = db
router := GoCertRouter(env)
router := NewGoCertRouter(env)

s := &http.Server{
Addr: fmt.Sprintf(":%d", config.Port),
Expand Down

0 comments on commit 22b6173

Please sign in to comment.