config

package
v0.0.0-...-e163d20 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bool

type Bool bool

func (*Bool) UnmarshalText

func (b *Bool) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface. This allows Bool to be filled from a string in the environment variables.

type Config

type Config struct {
	Port         string        `envconfig:"PORT"`
	Hostname     string        `envconfig:"HOSTNAME"`
	Tls          Bool          `envconfig:"TLS" default:"true"`
	PullInterval time.Duration `envconfig:"CG_PULL_INTERVAL"`

	RedisAddrs    string `envconfig:"REDIS_ADDRS"`
	RedisUsername string `envconfig:"REDIS_USERNAME"`
	RedisPassword string `envconfig:"REDIS_PASSWORD"`
	RedisTls      Bool   `envconfig:"REDIS_TLS"`

	EtcdAddrs    []string `envconfig:"ETCD_ADDRS" delim:","`
	EtcdUsername string   `envconfig:"ETCD_USERNAME"`
	EtcdPassword string   `envconfig:"ETCD_PASSWORD"`
	EtcdTls      Bool     `envconfig:"ETCD_TLS"`

	// cfg repo
	RepoUrl    string   `envconfig:"GIT_REPOSITORY_URL"`
	RepoEnvs   []string `envconfig:"GIT_REPOSITORY_ENVS" delim:","`
	RepoBranch string   `envconfig:"GIT_REPOSITORY_BRANCH" default:"main"`

	// k8s
	LeaseLockName      string        `envconfig:"K8S_LEASE_LOCK_NAME" default:"configleam-lock"`
	LeaseLockNamespace string        `envconfig:"K8S_LEASE_LOCK_NAMESPACE" default:"default"`
	LeaseDuration      time.Duration `envconfig:"K8S_LEASE_DURATION"`
	RenewDeadline      time.Duration `envconfig:"K8S_RENEW_DEADLINE"`
	RetryPeriod        time.Duration `envconfig:"K8S_RETRY_PERIOD"`

	EnableLeaderElection Bool `envconfig:"K8S_ENABLE_LEADER_ELECTION"`
}

func Get

func Get() (*Config, error)

Get reads config from environment. Once.

Jump to

Keyboard shortcuts

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