config

package
v3.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RandomDurationAround

func RandomDurationAround(duration time.Duration, scatteringPercentage float64) time.Duration

RandomDurationAround returns a duration (1.0 - percent) * duration < n < (1.0 + percent) * duration

Types

type Config

type Config struct {
	Hostname            string        `envconfig:"HOSTNAME"`
	User                string        `envconfig:"USER"`
	Password            string        `envconfig:"PASSWORD"`
	Port                int           `envconfig:"PORT" default:"1313"`
	KeepAliveInterval   time.Duration `envconfig:"KEEPALIVE_INTERVAL" default:"3s"`
	KeepAliveRetry      int           `envconfig:"KEEPALIVE_RETRY" default:"5"`
	HealthCheckInterval time.Duration `envconfig:"HEALTH_CHECK_INTERVAL" default:"5s"`
	HealthCheckTimeout  time.Duration `envconfig:"HEALTH_CHECK_TIMEOUT" default:"5s"`

	PluginEnsureInterval time.Duration `envconfig:"PLUGIN_ENSURE_INTERVAL" default:"1s"`

	ARPGratuitousInterval   time.Duration `envconfig:"ARP_GRATUITOUS_INTERVAL" default:"1s"` // Deprecated: Use PluginEnsureInterval
	FailCountBeforeFailover int           `envconfig:"FAIL_COUNT_BEFORE_FAILOVER" default:"3"`

	SecretStorageEncryptionKey string `envconfig:"SECRET_STORAGE_ENCRYPTION_KEY" default:""`
}

func Build

func Build(ctx context.Context) (Config, error)

func (Config) LeaseTime

func (c Config) LeaseTime() time.Duration

LeaseTime is 5 * the global keepalive interval

Jump to

Keyboard shortcuts

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