server

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package server contains the server functions

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrCertFileMissing is returned when https is enabled but no cert file is provided
	ErrCertFileMissing = errors.New("no cert file found")

	// ErrKeyFileMissing is returned when https is enabled but no key file is provided
	ErrKeyFileMissing = errors.New("no key file found")
)

Functions

func NewOpenAPISpec

func NewOpenAPISpec() (*openapi3.T, error)

NewOpenAPISpec creates a new OpenAPI 3.1.0 specification based on the configured go interfaces and the operation types appended within the individual handlers

func NewRouter

func NewRouter() (*route.Router, error)

NewRouter creates a wrapper router so that the echo server and OAS specification can be generated simultaneously

Types

type APIKey

type APIKey struct {
	Name string
}

APIKey is a struct that represents an API Key security scheme

func (*APIKey) Scheme

func (k *APIKey) Scheme() *openapi3.SecurityScheme

Scheme returns the API Key security scheme

type Basic

type Basic struct {
	Username string
	Password string
}

Basic is a struct that represents a Basic Auth security scheme

func (*Basic) Scheme

func (b *Basic) Scheme() *openapi3.SecurityScheme

Scheme returns the Basic Auth security scheme

type OAuth2

type OAuth2 struct {
	AuthorizationURL string
	TokenURL         string
	RefreshURL       string
	Scopes           map[string]string
}

OAuth2 is a struct that represents an OAuth2 security scheme

func (*OAuth2) Scheme

func (i *OAuth2) Scheme() *openapi3.SecurityScheme

Scheme returns the OAuth2 security scheme

type OpenID

type OpenID struct {
	ConnectURL string
}

OpenID is a struct that represents an OpenID Connect security scheme

func (*OpenID) Scheme

func (i *OpenID) Scheme() *openapi3.SecurityScheme

Scheme returns the OpenID Connect security scheme

type Server

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

func NewServer

func NewServer(c config.Config, l *zap.SugaredLogger) *Server

NewServer returns a new Server configuration

func (*Server) AddHandler

func (s *Server) AddHandler(r handler)

AddHandler provides the ability to add additional HTTP handlers that process requests. The handler that is provided should have a Routes(*echo.Group) function, which allows the routes to be added to the server.

func (*Server) StartEchoServer

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

StartEchoServer creates and starts the echo server with configured middleware and handlers

Jump to

Keyboard shortcuts

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