httpgateway_server

package
v0.0.0-...-a6d1342 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2025 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package httpgateway_server provides the http gateway.

Index

Constants

This section is empty.

Variables

View Source
var (
	// DefaultAddress is the default Address to listen to.
	DefaultAddress = ":8080"

	// DefaultConfigSection is the section key used in config files used to
	// configure the gateway options.
	DefaultConfigSection = "httpgateway"
)

Functions

This section is empty.

Types

type Config

type Config struct {
	Enabled bool   `json:"enabled" yaml:"enabled"`
	Address string `json:"address" yaml:"address"`
}

Config represents the config for the httpgateway.

func NewConfig

func NewConfig() Config

NewConfig creates a config to use with a httpgateway.

type Option

type Option func(*Config)

Option is a functional option type for the httpgateway.

type Server

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

Server is a component implementing the http gateway.

func New

func New(cfg Config, logger log.Logger, client client.Type) *Server

New creates a new httpgateway component.

func Provide

func Provide(
	svcCtx *cli.ServiceContextWithConfig,
	components *types.Components,
	logger log.Logger,
	client client.Type,
) (*Server, error)

Provide provides the httpgateway component.

func (*Server) Add

func (s *Server) Add(routes *httpgateway_v1.Routes) error

Add adds the given routes to the gateway if there is no such route.

func (*Server) Remove

func (s *Server) Remove(paths *httpgateway_v1.Paths) error

Remove removes the given routes from the gateway.

func (*Server) Set

func (s *Server) Set(routes *httpgateway_v1.Routes) error

Set sets the given routes by path on the gateway.

func (*Server) Start

func (s *Server) Start(_ context.Context) error

Start starts the httpgateway.

func (*Server) Stop

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

Stop stops the httpgateway.

func (*Server) String

func (s *Server) String() string

String returns the name of the component.

func (*Server) Type

func (s *Server) Type() string

Type returns the type of the component.

Jump to

Keyboard shortcuts

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