configurator

package
v0.0.19 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2023 License: MPL-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromEnv

func FromEnv(config any, prefix string)

FromEnv reads the environment variables and sets the values to the given config.

Types

type Environment

type Environment struct {
	Name        string              `json:"name"`
	Description string              `json:"description"`
	Entries     []*EnvironmentEntry `json:"entries"`
}

Environment is a list of environment variables.

func NewEnvironment

func NewEnvironment(name, description string) *Environment

NewEnvironment creates a new Environment instance.

func ToEnv

func ToEnv(config any, name, description, prefix string) *Environment

ToEnv returns an environment struct with the values of the given config.

func (*Environment) Delete

func (e *Environment) Delete(key string)

Delete removes an EnvironmentEntry by key.

func (*Environment) Get

func (e *Environment) Get(key string) (*EnvironmentEntry, bool)

Get returns an EnvironmentEntry by key.

func (*Environment) Marshal

func (e *Environment) Marshal(format string) string

Marshal returns the Environment as a string in the given format.

func (*Environment) Set

func (e *Environment) Set(entry *EnvironmentEntry)

Set adds an EnvironmentEntry to the Environment.

type EnvironmentEntry

type EnvironmentEntry struct {
	Key    string `json:"key"`
	Value  string `json:"value"`
	Secret bool   `json:"secret"`
}

EnvironmentEntry is a key-value pair that represents an environment variable.

Jump to

Keyboard shortcuts

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