config

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package config is the config capability: the one place in a CSF process that reads the process environment.

Configuration is a capability like a socket or a file. A binary's main function obtains OSEnvironment once and hands the resulting Environment — or values parsed from it — to the services it constructs; a service never reads os.Getenv itself. Application policy (which names exist, their defaults and their validation) stays with the application that declares them. Pure parsing of configuration values that needs no process input lives in candace/pkg/config.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InheritedEnvironment

func InheritedEnvironment() []string

InheritedEnvironment is the whole process environment as name=value pairs: what a child process inherits. The process capability (candace/ipc/proc) reads it here, at launch, to extend a child's environment without reading the process environment itself.

Types

type Environment

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

Environment reads configuration from a named string source.

func NewEnvironment

func NewEnvironment(lookup func(name string) (string, bool)) Environment

NewEnvironment constructs an environment reader around lookup. A nil lookup is an empty environment, which keeps zero-input configuration deterministic.

func OSEnvironment

func OSEnvironment() Environment

OSEnvironment reads the current process environment.

func (Environment) Duration

func (environment Environment) Duration(name string, fallback time.Duration) (time.Duration, error)

Duration parses the named Go duration or returns fallback when it is empty.

func (Environment) First

func (environment Environment) First(names ...string) string

First returns the first non-empty named value.

func (Environment) Int32

func (environment Environment) Int32(name string, fallback int32) (int32, error)

Int32 parses the named base-10 integer or returns fallback when it is empty.

func (Environment) Raw

func (environment Environment) Raw(name string) string

Raw returns the trimmed named value.

func (Environment) String

func (environment Environment) String(name, fallback string) string

String returns the trimmed named value or fallback when it is empty.

Jump to

Keyboard shortcuts

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