cloudconfig

package
v0.60.0 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package cloudconfig provides primitives for loading configuration. Based on github.com/kelseyhightower/envconfig, with modifications.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

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

Config is a config.

func New

func New(name string, spec interface{}, options ...Option) (*Config, error)

New creates a new Config with the provided name, specification and options.

func (*Config) Load

func (c *Config) Load() error

Load values into the config.

func (*Config) MarshalLogObject

func (c *Config) MarshalLogObject(encoder zapcore.ObjectEncoder) error

MarshalLogObject implements zapcore.ObjectMarshaler.

func (*Config) PrintUsage

func (c *Config) PrintUsage(w io.Writer)

PrintUsage prints usage of the config to the provided io.Writer.

type Option

type Option func(*Config)

Option is a configuration option.

func WithAdditionalSpec

func WithAdditionalSpec(name string, spec interface{}) Option

WithAdditionalSpec includes an additional specification in the config loading.

func WithEnvPrefix

func WithEnvPrefix(envPrefix string) Option

WithEnvPrefix sets the environment prefix to use for config loading.

func WithOptionalSecrets added in v0.26.0

func WithOptionalSecrets() Option

WithOptionalSecrets overrides all secrets to be optional.

func WithYAMLServiceSpecificationFile

func WithYAMLServiceSpecificationFile(filename string) Option

WithYAMLServiceSpecificationFile sets the YAML service specification file to load environment variables from.

type Setter

type Setter interface {
	Set(value string) error
}

Setter is implemented by types can self-deserialize values. Any type that implements flag.Value also implements Setter.

Jump to

Keyboard shortcuts

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