Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
fearful-symmetry committed Apr 3, 2024
1 parent 39b3493 commit b419809
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions api/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,16 @@ func New(log *logp.Logger, mux *http.ServeMux, c *config.C) (*Server, error) {
if err != nil {
return nil, err
}
srv := &http.Server{ReadHeaderTimeout: cfg.Timeout}
l, err := makeListener(cfg)
if err != nil {
return nil, err
}

return &Server{mux: mux, srv: srv, l: l, config: cfg, log: log.Named("api")}, nil
return new(log, mux, cfg)
}

// NewFromConfig creates a new API server from the given Config object
// NewFromConfig creates a new API server from the given Config object.
func NewFromConfig(log *logp.Logger, mux *http.ServeMux, cfg Config) (*Server, error) {
return new(log, mux, cfg)
}

// new creates the server from a config struct
func new(log *logp.Logger, mux *http.ServeMux, cfg Config) (*Server, error) {
srv := &http.Server{ReadHeaderTimeout: cfg.Timeout}
l, err := makeListener(cfg)
if err != nil {
Expand Down

0 comments on commit b419809

Please sign in to comment.