Documentation
¶
Overview ¶
Package tomlx provides utilities for managing TOML configuration files.
This package offers a TomlConfigManager that can: - Read and update existing TOML files while preserving structure - Merge configuration maps recursively - Set nested configuration values using dot notation paths - Validate TOML configurations against expected values
It is primarily used by software installers to patch configuration files with sandbox-specific paths while maintaining the original structure.
Index ¶
- type TomlConfigManager
- func (tcm *TomlConfigManager) MergeConfigMaps(target, source map[string]interface{})
- func (tcm *TomlConfigManager) SetNestedValue(config map[string]interface{}, path string, value interface{})
- func (tcm *TomlConfigManager) UpdateTomlFile(filePath string, configUpdates map[string]interface{}) error
- func (tcm *TomlConfigManager) ValidateConfigValues(actual map[string]any, expected map[string]interface{}) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TomlConfigManager ¶
type TomlConfigManager struct{}
TomlConfigManager provides utilities for managing TOML configuration files
func NewTomlConfigManager ¶
func NewTomlConfigManager() *TomlConfigManager
NewTomlConfigManager creates a new TOML configuration manager
func (*TomlConfigManager) MergeConfigMaps ¶
func (tcm *TomlConfigManager) MergeConfigMaps(target, source map[string]interface{})
MergeConfigMaps recursively merges the source config into the target config
func (*TomlConfigManager) SetNestedValue ¶
func (tcm *TomlConfigManager) SetNestedValue(config map[string]interface{}, path string, value interface{})
SetNestedValue safely sets nested values in a map, creating intermediate maps as needed The value can be a string, slice, or any other type
func (*TomlConfigManager) UpdateTomlFile ¶
func (tcm *TomlConfigManager) UpdateTomlFile(filePath string, configUpdates map[string]interface{}) error
UpdateTomlFile reads a TOML file, applies configuration updates, and writes it back
func (*TomlConfigManager) ValidateConfigValues ¶
func (tcm *TomlConfigManager) ValidateConfigValues(actual map[string]any, expected map[string]interface{}) bool
ValidateConfigValues recursively validates that the actual TOML config matches the expected config