diff --git a/router.go b/router.go index f80113f..78ff0d6 100644 --- a/router.go +++ b/router.go @@ -6,12 +6,12 @@ import ( "somehole.com/service/router" ) -type Endpoints struct { +type Endpoint struct { CallbackEndpoint string TokenEndpoint string } -var defaultEndpoints = Endpoints{ +var endpointDefault = Endpoint{ CallbackEndpoint: "/callback", TokenEndpoint: "/token", } @@ -19,27 +19,30 @@ var defaultEndpoints = Endpoints{ type Router struct { *router.Router log.Logger - Endpoints + Endpoint } -func NewRouter(r *router.Router, logger log.Logger, endpointOverride ...Endpoints) (ro *Router) { - var endpoints Endpoints +func NewRouter(r *router.Router, logger log.Logger, endpointOverride ...Endpoint) (ro *Router) { + var endpoints Endpoint if r == nil { r = router.NewRouter(nil, nil) } if len(endpointOverride) == 1 { endpoints = endpointOverride[0] } else { - endpoints = defaultEndpoints + endpoints = endpointDefault } - r.AddRequiredRoutes([]string{endpoints.CallbackEndpoint, endpoints.TokenEndpoint}) + r.AddRequiredRoutes([]string{ + endpoints.CallbackEndpoint, + endpoints.TokenEndpoint, + }) if logger == nil { logger = log.NewPlainLogger() } return &Router{ - Router: r, - Logger: logger, - Endpoints: endpoints, + Router: r, + Logger: logger, + Endpoint: endpoints, } }