config

package
v0.0.0-...-d74a450 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2024 License: Apache-2.0 Imports: 7 Imported by: 14

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientTLSConfig

type ClientTLSConfig struct {
	Enabled  bool
	CertPath string
	KeyPath  string
	CAPath   string
}

type ClientTLSConfigSchema

type ClientTLSConfigSchema struct {
	Enabled  bool   `json:"enabled"`
	CertPath string `json:"cert_path"`
	KeyPath  string `json:"key_path"`
	CAPath   string `json:"ca_path"`
}

type Config

type Config struct {
	MessageBusServers          []MessageBusServer
	RoutingAPI                 RoutingAPI
	Routes                     []Route
	DynamicConfigGlobs         []string
	NATSmTLSConfig             ClientTLSConfig
	Host                       string
	AvailabilityZone           string `json:"availability_zone"`
	UnregistrationMessageLimit int
}

type ConfigSchema

type ConfigSchema struct {
	MessageBusServers          []MessageBusServerSchema `json:"message_bus_servers"`
	RoutingAPI                 RoutingAPISchema         `json:"routing_api"`
	Routes                     []RouteSchema            `json:"routes"`
	DynamicConfigGlobs         []string                 `json:"dynamic_config_globs"`
	NATSmTLSConfig             ClientTLSConfigSchema    `json:"nats_mtls_config"`
	Host                       string                   `json:"host"`
	AvailabilityZone           string                   `json:"availability_zone"`
	UnregistrationMessageLimit *int                     `json:"unregistration_message_limit,omitempty"`
}

func NewConfigSchemaFromFile

func NewConfigSchemaFromFile(configFile string) (ConfigSchema, error)

func (ConfigSchema) ParseSchemaAndSetDefaultsToConfig

func (c ConfigSchema) ParseSchemaAndSetDefaultsToConfig() (*Config, error)

type HealthCheck

type HealthCheck struct {
	Name       string
	ScriptPath string
	Timeout    time.Duration
}

type HealthCheckSchema

type HealthCheckSchema struct {
	Name       string `json:"name" yaml:"name"`
	ScriptPath string `json:"script_path" yaml:"script_path"`
	Timeout    string `json:"timeout" yaml:"timeout"`
}

type LoadBalancingAlgorithm

type LoadBalancingAlgorithm string
const (
	RoundRobin LoadBalancingAlgorithm = "round-robin"
	LeastConns LoadBalancingAlgorithm = "least-connection"
)

type MessageBusServer

type MessageBusServer struct {
	Host     string
	User     string
	Password string
}

type MessageBusServerSchema

type MessageBusServerSchema struct {
	Host     string `json:"host"`
	User     string `json:"user"`
	Password string `json:"password"`
}

type Options

type Options struct {
	LoadBalancingAlgorithm LoadBalancingAlgorithm `json:"lb_algo,omitempty" yaml:"lb_algo,omitempty"`
}

type Route

type Route struct {
	Type                 string
	Name                 string
	Port                 *uint16
	Protocol             string
	TLSPort              *uint16
	Tags                 map[string]string
	URIs                 []string
	RouterGroup          string
	Host                 string
	ExternalPort         *uint16
	RouteServiceUrl      string
	RegistrationInterval time.Duration
	HealthCheck          *HealthCheck
	ServerCertDomainSAN  string
	Options              *Options
}

func RouteFromSchema

func RouteFromSchema(r RouteSchema, index int, host string) (*Route, error)

type RouteSchema

type RouteSchema struct {
	Type                 string             `json:"type" yaml:"type"`
	Name                 string             `json:"name" yaml:"name"`
	Host                 string             `json:"host" yaml:"host"`
	Port                 *uint16            `json:"port" yaml:"port"`
	Protocol             string             `json:"protocol" yaml:"protocol"`
	SniPort              *uint16            `json:"sni_port" yaml:"sni_port"`
	TLSPort              *uint16            `json:"tls_port" yaml:"tls_port"`
	Tags                 map[string]string  `json:"tags" yaml:"tags"`
	URIs                 []string           `json:"uris" yaml:"uris"`
	RouterGroup          string             `json:"router_group" yaml:"router_group"`
	ExternalPort         *uint16            `json:"external_port,omitempty" yaml:"external_port,omitempty"`
	RouteServiceUrl      string             `json:"route_service_url" yaml:"route_service_url"`
	RegistrationInterval string             `json:"registration_interval,omitempty" yaml:"registration_interval,omitempty"`
	HealthCheck          *HealthCheckSchema `json:"health_check,omitempty" yaml:"health_check,omitempty"`
	ServerCertDomainSAN  string             `json:"server_cert_domain_san,omitempty" yaml:"server_cert_domain_san,omitempty"`
	SniRoutableSan       string             `json:"sni_routable_san,omitempty" yaml:"sni_routable_san,omitempty"`
	Options              *Options           `json:"options,omitempty" yaml:"options,omitempty"`
}

type RoutingAPI

type RoutingAPI struct {
	APIURL            string
	OAuthURL          string
	ClientID          string
	ClientSecret      string
	CACerts           string
	SkipSSLValidation bool

	ClientCertificatePath   string
	ClientPrivateKeyPath    string
	ServerCACertificatePath string

	MaxTTL time.Duration
}

type RoutingAPISchema

type RoutingAPISchema struct {
	APIURL            string `json:"api_url"`
	OAuthURL          string `json:"oauth_url"`
	ClientID          string `json:"client_id"`
	ClientSecret      string `json:"client_secret"`
	CACerts           string `json:"ca_certs"`
	SkipSSLValidation bool   `json:"skip_ssl_validation"`

	ClientCertificatePath   string `json:"client_cert_path"`
	ClientPrivateKeyPath    string `json:"client_private_key_path"`
	ServerCACertificatePath string `json:"server_ca_cert_path"`
	MaxTTL                  string `json:"max_ttl,omitempty"`
}

Jump to

Keyboard shortcuts

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