envvars

package
v0.2.0-387 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Build

func Build(obj interface{}, path ...string) (map[string]string, error)

Build returns an environment variable dictionary with an entry for each leaf containing a scalar value.

Example:

src := map[string]interface{}{
	"status": map[string]interface{}{
		"listeners": []map[string]interface{}{
			{
				"type": "secure",
				"addresses": []map[string]interface{}{
					{
						"host": "my-cluster-kafka-bootstrap.coffeeshop.svc",
						"port": "9093",
					},
				},
			},
		},
	},
}
actual, _ := Build(src)

actual should contain the following values:

"STATUS_LISTENERS_0_TYPE":             "secure",
"STATUS_LISTENERS_0_ADDRESSES_0_HOST": "my-cluster-kafka-bootstrap.coffeeshop.svc",
"STATUS_LISTENERS_0_ADDRESSES_0_PORT": "9093",

Now, consider the following example:

actual, _ = Build(src, "kafka")

actual should contain the following values instead:

"KAFKA_STATUS_LISTENERS_0_TYPE":             "secure",
"KAFKA_STATUS_LISTENERS_0_ADDRESSES_0_HOST": "my-cluster-kafka-bootstrap.coffeeshop.svc",
"KAFKA_STATUS_LISTENERS_0_ADDRESSES_0_PORT": "9093",

Types

This section is empty.

Jump to

Keyboard shortcuts

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