env

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package env implements the environment variable configuration source, fulfilling the core/config/Source interface.

Index

Constants

View Source
const (
	// Name is the unique identifier for the environment variable source.
	Name = "env"
	// Priority defines the precedence of this source.
	// A value of 0 indicates the absolute highest priority,
	// meaning environment variables will override CLI flags, files, and remote configs.
	Priority = 0
)

Variables

This section is empty.

Functions

func New

func New(options *config.SourceOptions) (config.Sourcer, error)

New initializes the environment variable configuration source.

Types

type Env

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

Env handles reading and writing configuration via OS environment variables.

func (*Env) Disconnect

func (s *Env) Disconnect()

Disconnect is a no-op for environment variables as they don't require active connections.

func (*Env) GetAll

func (s *Env) GetAll() map[string]*config.Value

GetAll scans all OS environment variables and converts them into framework-compatible keys. It converts underscores (_) to dots (.) to match the internal configuration hierarchy. Example: "ASJARD_SERVER_PORT=8080" becomes the key "asjard.server.port".

func (*Env) Name

func (s *Env) Name() string

Name returns "env".

func (*Env) Priority

func (s *Env) Priority() int

Priority returns the precedence level (0 = Highest).

func (*Env) Set

func (s *Env) Set(key string, value any) error

Set updates an environment variable and triggers a configuration change event. It converts internal dot-notation keys back to underscore-notation.

Jump to

Keyboard shortcuts

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