Documentation ¶
Index ¶
- Constants
- Variables
- func CheckRequired(ctx *cli.Context) error
- func LoadStore(cfg CLIConfig, ctx context.Context, log log.Logger) (store.Store, error)
- func ReadDomainFilter(r *http.Request) (common.DomainType, error)
- func WithLogging(handleFn func(http.ResponseWriter, *http.Request) error, log log.Logger) func(http.ResponseWriter, *http.Request)
- func WithMetrics(handleFn func(http.ResponseWriter, *http.Request) error, m metrics.Metricer) func(http.ResponseWriter, *http.Request) error
- type CLIConfig
- type Server
- func (svr *Server) Endpoint() string
- func (svr *Server) HandleGet(w http.ResponseWriter, r *http.Request) error
- func (svr *Server) HandlePut(w http.ResponseWriter, r *http.Request) error
- func (svr *Server) Health(w http.ResponseWriter, r *http.Request) error
- func (svr *Server) Start() error
- func (svr *Server) Stop() error
- func (svr *Server) WriteBadRequest(w http.ResponseWriter, msg string)
- func (svr *Server) WriteInternalError(w http.ResponseWriter, err error)
- func (svr *Server) WriteNotFound(w http.ResponseWriter, msg string)
- func (svr *Server) WriteResponse(w http.ResponseWriter, data []byte)
Constants ¶
View Source
const ( ListenAddrFlagName = "addr" PortFlagName = "port" )
View Source
const ( GetRoute = "/get/" PutRoute = "/put/" DomainFilterKey = "domain" )
View Source
const EnvVarPrefix = "EIGENDA_PROXY"
Variables ¶
View Source
var ( ListenAddrFlag = &cli.StringFlag{ Name: ListenAddrFlagName, Usage: "server listening address", Value: "127.0.0.1", EnvVars: prefixEnvVars("ADDR"), } PortFlag = &cli.IntFlag{ Name: PortFlagName, Usage: "server listening port", Value: 3100, EnvVars: prefixEnvVars("PORT"), } )
View Source
var (
ErrNotFound = errors.New("not found")
)
View Source
var Flags []cli.Flag
Flags contains the list of configuration options available to the binary.
Functions ¶
func CheckRequired ¶
func CheckRequired(ctx *cli.Context) error
func ReadDomainFilter ¶
func ReadDomainFilter(r *http.Request) (common.DomainType, error)
func WithLogging ¶
func WithMetrics ¶
func WithMetrics(handleFn func(http.ResponseWriter, *http.Request) error, m metrics.Metricer) func(http.ResponseWriter, *http.Request) error
WithMetrics is a middleware that records metrics for the route path.
Types ¶
type CLIConfig ¶
type CLIConfig struct { MemStoreCfg store.MemStoreConfig EigenDAConfig eigenda.Config MetricsCfg opmetrics.CLIConfig }
func ReadCLIConfig ¶
func ReadCLIConfig(ctx *cli.Context) CLIConfig
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) WriteBadRequest ¶
func (svr *Server) WriteBadRequest(w http.ResponseWriter, msg string)
func (*Server) WriteInternalError ¶
func (svr *Server) WriteInternalError(w http.ResponseWriter, err error)
func (*Server) WriteNotFound ¶
func (svr *Server) WriteNotFound(w http.ResponseWriter, msg string)
func (*Server) WriteResponse ¶
func (svr *Server) WriteResponse(w http.ResponseWriter, data []byte)
Click to show internal directories.
Click to hide internal directories.