http

package
v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 17, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Address string `yaml:"address" env:"WEB_ADDRESS" env-default:"0.0.0.0" env-description:"Listen address"`
	Port    string `yaml:"port" env:"WEB_PORT" env-default:"80" env-description:"Listen port"`

	Session middleware.SessionConfig `yaml:"session"`
	CSRF    middleware.CSRFConfig    `yaml:"csrf"`
	CORS    middleware.CORSConfig    `yaml:"cors"`

	EnableInternalAPI bool `` /* 155-byte string literal not displayed */
}

type Opt

type Opt func(s *Server)

func NoOpt

func NoOpt() Opt

func When added in v0.1.3

func When(cond bool, opt Opt) Opt

func WithAuthDebug

func WithAuthDebug(files fs.FS) Opt

func WithBodyDump

func WithBodyDump() Opt

func WithDashboardAPI

func WithDashboardAPI(
	cfg Config,
	handler *merchantapi.Handler,
	authHandler *merchantauth.Handler,
	tokensManager *auth.TokenAuthManager,
	users *user.Service,
	enableEmailAuth bool,
	enableGoogleAuth bool,
) Opt

WithDashboardAPI setups routes for Merchant's Dashboard (app.o2pay.co)

func WithDocs

func WithDocs(files fs.FS) Opt

func WithEmbeddedFrontend

func WithEmbeddedFrontend(dashboardUI, paymentsUI fs.FS) Opt

func WithInternalAPI

func WithInternalAPI(h *v1.Handler) Opt

func WithLogger

func WithLogger(logger *zerolog.Logger) Opt

func WithMerchantAPI

func WithMerchantAPI(handler *merchantapi.Handler, tokensManager *auth.TokenAuthManager) Opt

WithMerchantAPI setups Merchant's API routes (api.o2pay.co)

func WithPaymentAPI

func WithPaymentAPI(handler *paymentapi.Handler, cfg Config) Opt

WithPaymentAPI setups routes public-facing payment api (pay.o2pay.co)

func WithRecover

func WithRecover() Opt

func WithWebhookAPI

func WithWebhookAPI(handler *webhook.Handler) Opt

type Server

type Server struct {
	// contains filtered or unexported fields
}

func New

func New(cfg Config, logRequests bool, opts ...Opt) *Server

func (*Server) Address

func (s *Server) Address() string

func (*Server) Echo

func (s *Server) Echo() *echo.Echo

func (*Server) Run

func (s *Server) Run() error

func (*Server) Shutdown

func (s *Server) Shutdown(ctx context.Context) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL