Configuration Management

SolidGroundUX DocumentationSolidGroundUX
NL

Load, manage, and persist configuration settings

Source: target-root/usr/local/lib/solidgroundux/common/sgnd-cfg.sh

Load, manage, and persist configuration settings

Public functions

Internal functions
FunctionPurposeArgumentsOutput
_sgnd_lib_guardEnsure direct execution is rejected and record that the library has been sourced.——
_sgnd_is_identCheck whether text is a valid Bash variable identifier.- $1 — Candidate identifier.—
_sgnd_kv_load_fileRead valid KEY=VALUE lines into variables in the current shell.- $1 — Path of a key/value file.—
_sgnd_kv_setWrite or replace one key in a private key/value file.- $1 — Destination file.—
_sgnd_kv_unsetRemove one key from a KEY=VALUE file.- $1 — File path.—
_sgnd_kv_reset_fileDelete a key/value file if it exists.- $1 — File path.—
_sgnd_kv_getRead the first matching key from a readable KEY=VALUE file.- $1 — File path.Writes the exact value after the first equals sign without a trailing newline.
_sgnd_kv_hasTest whether a valid key is present, including an empty value.- $1 — File path.—
_sgnd_kv_list_keysList identifier/value pairs from a readable configuration file.- $1 — File path.Writes one KEY\
_sgnd_cfg_write_template_headerGenerate a comment header for a configuration template.- $1 — Optional domain name (defaults to configuration).Writes comment lines to standard output.

Description

Provides configuration handling for the SolidGroundUX framework.

The library:

  • Loads configuration from system and user locations
  • Resolves effective configuration using precedence rules
  • Supports reading and writing key-value configuration files
  • Ensures required configuration values are present
  • Provides helper functions for accessing configuration values
  • Integrates with bootstrap and runtime state handling

Design principles

  • Clear separation between system-level and user-level configuration
  • Deterministic resolution of configuration values
  • Minimal and transparent configuration format
  • Safe defaults with optional overrides

Role in framework

  • Central configuration layer used during bootstrap and runtime
  • Supplies paths, settings, and environment-specific values
  • Supports scripts and modules requiring persistent configuration

Non-goals

  • Complex hierarchical configuration systems
  • External configuration formats (JSON, YAML, etc.)
  • Runtime hot-reloading of configuration