config

package
v0.0.0-...-99e1d97 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// The default port.
	DefaultPort uint16 = 80

	// The default configuration file path.
	DefaultConfigFilePath string = "/etc/revx/config.yaml"
)

Constant declarations.

Variables

View Source
var Global = Default()

The global configuration.

Functions

func LoadConfig

func LoadConfig(path string) error

Description:

Loads the configuration from a given file path.

Parameters:

path The configuration file path.

Returns:

The reverse proxy configuration object.

Types

type ConfigReverseProxyServer

type ConfigReverseProxyServer struct {

	// The name of the server.
	// Only serves identification purposes.
	Name string `yaml:"name" json:"name"`

	// The context path which is used to route to the server.
	// All requested routes starting with this context path will be proxy forwarded to one of the given upstreams.
	// Context paths must be unique.
	//
	// If the context path of this server is example/,
	// the following routes will be forwarded to this server:
	//	- example/
	//	- example/value
	//	- example/subroute/value
	//	- example/*
	Context string `yaml:"context" json:"context"`

	// The registered server upstreams.
	// Any server can have multiple upstreams.
	// revx is then going ahead and load balances traffic between all registered upstreams.
	Upstreams []string `yaml:"upstreams" json:"upstreams"`

	// The allowed http methods, e.g. GET, POST, ...
	AllowedMethods []string `yaml:"allowed-methods" json:"allowedMethods"`

	// The health check configuration.
	HealthCheck ConfigReverseProxyServerHealthCheck `yaml:"health-check" json:"healthCheck"`
}

Description:

Represents a service configuration.

type ConfigReverseProxyServerHealthCheck

type ConfigReverseProxyServerHealthCheck struct {

	// The health check endpoint.
	Endpoint string `yaml:"endpoint" json:"endpoint"`

	// The health check interval.
	Interval uint32 `yaml:"interval" json:"interval"`

	// The maximum amount of fails.
	// If this amount of fails is exceeded, the upstream is considered unhealthy.
	Fails uint32 `yaml:"fails" json:"fails"`
}

Description:

Represents a service health check configuration.

type ConfigRevx

type ConfigRevx struct {

	// The port to run revx on.
	Port uint16 `yaml:"port" json:"port"`

	// The server configuration.
	Servers []ConfigReverseProxyServer `yaml:"servers" json:"servers,omitempty"`
}

Description:

Represents the top level configuration.

func Default

func Default() *ConfigRevx

Description:

Creates the default reverse proxy configuration.

Returns:

The default reverse proxy configuration.

Jump to

Keyboard shortcuts

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