config

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2023 License: Apache-2.0 Imports: 12 Imported by: 3

Documentation

Index

Constants

View Source
const DefaultClientTimeout = time.Second

DefaultClientTimeout defines the default http client timeout to use, if it is not supplied in the config

Variables

This section is empty.

Functions

func InitComponentFromConfig added in v0.2.0

func InitComponentFromConfig(configPath string) (fiber.Component, error)

InitComponentFromConfig takes in the path to a config file, parses the contents and if successful, constructs a fiber Component

Types

type CombinerConfig

type CombinerConfig struct {
	MultiRouteConfig
	FanIn FanInConfig `json:"fan_in" required:"true"`
}

CombinerConfig is used to parse the configuration for a Combiner

type ComponentConfig

type ComponentConfig struct {
	ID   string `json:"id" required:"true"`
	Type string `json:"type" required:"true"`
}

ComponentConfig is used to parse the base properties for a component

type Config

type Config interface {
	// contains filtered or unexported methods
}

Config is the base interface to initialise a network from a config file

type Duration

type Duration time.Duration

Duration is an alias for time.Duration (required since time.Duration Unmarshal is not defined)

func (Duration) MarshalJSON

func (d Duration) MarshalJSON() ([]byte, error)

MarshalJSON converts the Duration object the byte representation of its human-readable format

func (*Duration) UnmarshalJSON

func (d *Duration) UnmarshalJSON(b []byte) error

UnmarshalJSON converts the byte representation of the Duration object into time.Duration

type FanInConfig

type FanInConfig struct {
	Type       string          `json:"type" required:"true"`
	Properties json.RawMessage `json:"properties" yaml:"properties,omitempty"`
}

FanInConfig is used to parse the configuration for a FanIn

func (*FanInConfig) FanIn

func (c *FanInConfig) FanIn() (fiber.FanIn, error)

FanIn takes a reference to a FanInConfig and creates a FanIn

type GrpcConfig added in v0.2.0

type GrpcConfig struct {
	ServiceMethod string `json:"service_method,omitempty"`
}

type MultiRouteConfig

type MultiRouteConfig struct {
	ComponentConfig
	Routes Routes `json:"routes" required:"true"`
}

MultiRouteConfig is used to parse the configuration for a MultiRouteComponent

type ProxyConfig

type ProxyConfig struct {
	ComponentConfig
	Endpoint string            `json:"endpoint" required:"true"`
	Timeout  Duration          `json:"timeout"`
	Protocol protocol.Protocol `json:"protocol"`
	GrpcConfig
}

ProxyConfig is used to parse the configuration for a Proxy

type RouterConfig

type RouterConfig struct {
	MultiRouteConfig
	Strategy StrategyConfig `json:"strategy" required:"true"`
}

RouterConfig is used to parse the configuration for a Router

type Routes

type Routes []Config

Routes represent a collection of configurations.

func (Routes) Routes

func (r Routes) Routes() (map[string]fiber.Component, error)

Routes takes in an object of type Routes and returns a map of each route's ID and the route

func (Routes) UnmarshalJSON

func (r Routes) UnmarshalJSON(b []byte) error

UnmarshalJSON is used to parse a given input byte array to config objects

type StrategyConfig

type StrategyConfig struct {
	Type       string          `json:"type" required:"true"`
	Properties json.RawMessage `json:"properties" yaml:"properties,omitempty"`
}

StrategyConfig is used to parse the configuration for a RoutingStrategy

func (*StrategyConfig) Strategy

func (c *StrategyConfig) Strategy() (fiber.RoutingStrategy, error)

Strategy takes a reference to a StrategyConfig and creates a RoutingStrategy

Jump to

Keyboard shortcuts

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