configs

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// KeyNamespace is the same that you would use with kubectl --namespace
	// just define it in your namespace specific helm chart
	KeyNamespace = "KUBE_NAMESPACE"
	DefNamespace = "default"

	// KeyLeaseScope is used as a prefix for leases.
	// leases are scoped by default only to namespace, so this scopes them
	// to your service to ensure leases from multiple services do not collide
	// for that reason, just use your service name such as tm-sync
	KeyLeaseScope = "KUBE_LEASE_SCOPE"
	DefLeaseScope = "unscoped"

	// KeyConfigPath is only needed by tests ran on your local machine
	// which must talk to the real external k8s system using your own account
	// 99.9% of your tests should use the mock client rather than do this.
	// if you do decide to use it your own local config file is used
	// which is likely /home/YOUR_USER_NAME/.kube/config
	KeyConfigPath = "KUBE_CONFIG_PATH"

	// KeyPodName is only needed to allow tests to simulate different pod's
	// each running instance of the application will generate its own
	// global unique ID, this will not match what you see
	KeyPodName = "KUBE_POD_NAME"
)

Variables

View Source
var FromEnv = os.Getenv

Functions

This section is empty.

Types

type ConfBuilder

type ConfBuilder struct {
	// contains filtered or unexported fields
}

func NewBuilder

func NewBuilder(def func(string) string, m map[string]string) ConfBuilder

func (ConfBuilder) Build

func (b ConfBuilder) Build() Config

func (ConfBuilder) With

func (b ConfBuilder) With(k, v string) ConfBuilder

func (ConfBuilder) WithDefaultFN

func (b ConfBuilder) WithDefaultFN(fn func(string) string) ConfBuilder

func (ConfBuilder) WithMap

func (b ConfBuilder) WithMap(m map[string]string) ConfBuilder

type Config

type Config = func(string) string // os.Getenv | viper.GetString etc

func FromMap

func FromMap(m map[string]string) Config

func New

func New() Config

func WithDefaults

func WithDefaults(conf Config, m map[string]string) Config

Jump to

Keyboard shortcuts

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