scope

package
v1.18.0 Latest Latest
Warning

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

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

Documentation

Overview

package: scope / config type: struct job: a resolution-free Section over a flat map, for known values and tests limits: flat leaves only; cfgSection resolves env()/vault() (-> config)

This file provides Literal: a Section whose values are already-known literals, with no env()/vault() resolution and no nested sections or arrays. The config-driven handout (config.cfgSection) is unexported, so an adapter test — which per the architecture must drive its real counterpart — uses Literal to build the section it hands its constructor.

package: scope / config type: interface job: the navigable, lazily-resolved handoff between the composition root and one adapter limits: interfaces only; the concrete tree + env()/vault() resolution live in config (-> config)

Narrowing is by containment: a sibling's settings and another port's secrets are simply not in the object an adapter was handed.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Section

type Section interface {
	// GetSection descends; a missing key yields an empty Section, never nil.
	GetSection(key string) Section

	// Get resolves the leaf at key, expanding an env()/vault() reference on demand, so a
	// rotating secret is fetched at use. The source (literal, env(), vault())
	// is chosen by config and opaque here. It errors when the key is absent, or
	// when resolving its source (an unset env var, an unreachable vault) fails; an
	// adapter judges required-ness from that error, or checks HasValue first.
	Get(ctx context.Context, key string) (string, error)

	// GetArray returns the elements of an array-valued key, each wrapped as a
	// Section. A missing key or a non-array value yields an empty slice. Config
	// arrays are always arrays of objects (a stack's layers, a partition's shards,
	// the endpoints, the accounts), so callers range over the result.
	GetArray(key string) []Section

	// HasValue reports whether key is present as a leaf value — not a nested
	// section and not an array. Use it to make an optional setting default cleanly.
	HasValue(key string) bool

	// HasSection reports whether key is present as a nested section.
	HasSection(key string) bool

	// HasArray reports whether key is present as an array.
	HasArray(key string) bool

	// HasKey reports whether a key is present at all.
	HasKey(key string) bool

	// Keys lists the present keys in this section, resolving nothing. It is for
	// structural iteration (e.g. a list of configured endpoints).
	Keys() []string
}

Section is one instance's slice of the launch config, reaching only inward.

func Literal

func Literal(values map[string]string) Section

Literal wraps a flat map of known values as a Section. Values resolve to themselves; there are no nested sections or arrays.

Jump to

Keyboard shortcuts

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