config

package
v1.13.0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package config provides methods to get configuration parameters from environment variables

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Name                   string          `default:"vlan-server" desc:"Name of the endpoint"`
	ConnectTo              url.URL         `default:"nsm-registry-svc:5002" desc:"url of registry service to connect to" split_words:"true"`
	MaxTokenLifetime       time.Duration   `default:"24h" desc:"maximum lifetime of tokens" split_words:"true"`
	RegistryClientPolicies []string        `` /* 187-byte string literal not displayed */
	CidrPrefix             cidr.Groups     `default:"169.254.0.0/16" desc:"CIDR Prefix to assign IPs (IPv4 and/or IPv6) from" split_words:"true"`
	RegisterService        bool            `default:"true" desc:"if true then registers network service on startup" split_words:"true"`
	ListenOn               url.URL         `default:"tcp://:5003" desc:"tcp:// url to be listen on. It will be used as public to register NSM" split_words:"true"`
	OpenTelemetryEndpoint  string          `default:"otel-collector.observability.svc.cluster.local:4317" desc:"OpenTelemetry Collector Endpoint"`
	MetricsExportInterval  time.Duration   `default:"10s" desc:"interval between mertics exports" split_words:"true"`
	LogLevel               string          `default:"INFO" desc:"Log level" split_words:"true"`
	Services               []ServiceConfig `default:"" desc:"list of supported services"`
}

Config holds configuration parameters from environment variables

func (*Config) Process

func (c *Config) Process() error

Process prints and processes env to config

type ServiceConfig

type ServiceConfig struct {
	Name    string
	Domain  string
	Via     string
	VLANTag int32
	Labels  map[string]string
}

ServiceConfig is a per-service config

func (*ServiceConfig) InitValues

func (s *ServiceConfig) InitValues()

InitValues set initial values for ServiceConfig

func (*ServiceConfig) UnmarshalBinary

func (s *ServiceConfig) UnmarshalBinary(bytes []byte) (err error)

UnmarshalBinary expects string(bytes) to be in format: Name { domain: Domain; vlan: VLANTag; labels: Labels; via: Via; } Labels = label_1=value_1&label_2=value_2

Jump to

Keyboard shortcuts

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