config

package
v0.0.0-...-c3cb3ef Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EnvironmentVariables

type EnvironmentVariables struct {
	BobDir          string
	SrcDir          string
	ConfigOpts      string
	ConfigFile      string
	ConfigJSON      string
	LogWarningsFile string
	LogWarnings     string
	BuildMetaFile   string
}

Stores all environment variables passed to Bob at runtime as a singleton.

func GetEnvironmentVariables

func GetEnvironmentVariables() *EnvironmentVariables

Return the environment variables. If called for the first time, read the environment once and store it for future use. These are not initialized on module entry to allow gendiffer to override these for testing.

type Properties

type Properties struct {
	// Map of all available features (e.g. noasserts: { cflags: ["-DNDEBUG]" }),
	// and whether they are enabled or not.
	Features map[string]bool

	// Map of all available properties which can be used in templates. Features are
	// not automatically included in this by Bob, so should be added explicitly by the
	// config system if required. These are converted to strings, then made available
	// for use in templates.
	Properties map[string]interface{}

	// Sorted array of available features
	FeatureList []string
	// contains filtered or unexported fields
}

func CreateMockConfig

func CreateMockConfig(overrides map[string]interface{}) *Properties

Initializes a mock config used for unit tests.

`overrides` can be used to set particular config values to a desired state for the target tests.

func (Properties) GetBool

func (properties Properties) GetBool(name string) bool

func (Properties) GetInt

func (properties Properties) GetInt(name string) int

func (Properties) GetString

func (properties Properties) GetString(name string) string

func (*Properties) LoadConfig

func (properties *Properties) LoadConfig(filename string) error

func (*Properties) SetConfig

func (properties *Properties) SetConfig(m map[string]string)

Loads the config map directly, used for testing.

func (Properties) StringMap

func (properties Properties) StringMap() map[string]string

Jump to

Keyboard shortcuts

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