cfgmap

package
v1.100.3 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package cfgmap holds typed accessors for reading values out of the map[string]any config blobs the platform loads from YAML/JSON. YAML and JSON decode into map[string]any with values of varying concrete types (int vs float64, string durations, etc.), so these helpers centralize the type assertions and defaulting used across the platform's config resolution.

Split out of pkg/platform to keep that package under its size budget (#756).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bool

func Bool(cfg map[string]any, key string) bool

Bool returns the bool value at key, or false if absent or not a bool.

func BoolDefault

func BoolDefault(cfg map[string]any, key string, defaultVal bool) bool

BoolDefault returns the bool value at key, or defaultVal if absent or not a bool. Use this for flags that default to true.

func Duration

func Duration(cfg map[string]any, key string, defaultVal time.Duration) time.Duration

Duration returns the duration at key. A string is parsed with time.ParseDuration; a bare number (int or JSON float64) is interpreted as seconds. Returns defaultVal if absent or unparseable.

func Int

func Int(cfg map[string]any, key string, defaultVal int) int

Int returns the int value at key, accepting JSON's float64 numbers, or defaultVal if absent or not numeric.

func String

func String(cfg map[string]any, key string) string

String returns the string value at key, or "" if absent or not a string.

Types

This section is empty.

Jump to

Keyboard shortcuts

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