config

package
v0.0.0-...-0a82276 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2024 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func KnownConfigKeys

func KnownConfigKeys(schema environschema.Fields) set.Strings

KnownConfigKeys returns the valid config keys.

Types

type Config

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

Config encapsulates config for an entity.

func NewConfig

func NewConfig(attrs map[string]interface{}, schema environschema.Fields, defaults schema.Defaults) (*Config, error)

NewConfig returns a new config instance with the given attributes and allowing for the extra provider attributes.

func (*Config) Attributes

func (c *Config) Attributes() ConfigAttributes

Attributes returns all the config attributes.

func (*Config) Validate

func (c *Config) Validate() error

Validate returns an error if the config is not valid.

type ConfigAttributes

type ConfigAttributes map[string]interface{}

ConfigAttributes represents config for an entity.

func (ConfigAttributes) Get

func (c ConfigAttributes) Get(attrName string, defaultValue interface{}) interface{}

Get gets the specified attribute.

func (ConfigAttributes) GetBool

func (c ConfigAttributes) GetBool(attrName string, defaultValue bool) bool

GetBool gets the specified bool attribute.

func (ConfigAttributes) GetInt

func (c ConfigAttributes) GetInt(attrName string, defaultValue int) int

GetInt gets the specified int attribute.

func (ConfigAttributes) GetString

func (c ConfigAttributes) GetString(attrName string, defaultValue string) string

GetString gets the specified string attribute.

func (ConfigAttributes) GetStringMap

func (c ConfigAttributes) GetStringMap(attrName string, defaultValue map[string]string) (map[string]string, error)

GetStringMap gets the specified map attribute as map[string]string.

Jump to

Keyboard shortcuts

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