Skip to content

Make Server accept a config struct #7

Description

@dchest

Currently, Server, accepts imgWidth and imgHeight. I'd like to change it to accept a configuration struct to make it easier to expand it without API change:

type ServerConfig struct {
   ImgWidth  int
   ImgHeight int
}

func Server(config *ServerConfig) http.Handler

Another idea is to make top-level functions methods on config (renamed Server or something):

type Server struct {
   ImgWidth     int
   ImgHeight    int
   Store        Store
   CollectNum   int
   Expiration   time.Time
}

func (c *Server) Handler() http.Handler

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions