Commit Graph

11 Commits

Author SHA1 Message Date
42161ce489 Add build target with version injection via ldflags
- Update Makefile to inject VERSION and GIT_COMMIT at build time
- Change Version from const to var to allow ldflags injection
- Add build target to create binary with proper version info
2025-07-22 13:50:24 +02:00
82f09a16ec Prepare for 1.0 release
- Fix Go version to 1.24.4 in go.mod
- Add version management with version.go
- Add --version flag to CLI tool
- Remove deprecated LoadFromFile and LoadFromReader methods
- Update tests to use new API
- Create TODO.md for future improvements
- Update README with Go version requirement

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-22 13:38:34 +02:00
47801ce852 Add gjson path support to all typed getters
This change enhances the API to support gjson path syntax for accessing nested configuration values. Users can now use paths like 'server.ssl.enabled' or 'database.replicas.0.host' to directly access nested values without manual navigation.

Key changes:
- All typed getters now support gjson path syntax
- Backward compatibility maintained for top-level keys
- Proper error handling for null values and non-existent paths
- Special float values (Infinity, NaN) handled correctly
- Comprehensive test coverage for edge cases

This makes the API much more intuitive and reduces boilerplate code when working with nested configuration structures.
2025-07-22 12:24:59 +02:00
6b8c16dd1d Implement proper YAML path navigation and complex type support
- YAML resolver now supports full path navigation (e.g., production.primary.host)
- Both JSON and YAML resolvers return YAML-formatted data for complex types
- This allows proper type preservation when loading objects/arrays from files
- Updated convertToType to parse YAML returned by resolvers
- Added comprehensive tests for YAML path navigation including arrays
- Fixed JSON resolver to support "." path for entire document
- All README examples now work correctly

The key insight was that resolvers should return YAML strings for complex
types, which can then be parsed and merged into the configuration structure,
preserving the original types (maps, arrays) instead of flattening to strings.
2025-07-21 18:57:13 +02:00
e7fa389634 Add safety check for numeric type conversions
Ensure that numeric conversions are lossless by verifying the converted
value matches the original string when converted back. This prevents:
- Loss of leading zeros (0123 stays as string)
- Loss of trailing zeros in floats (1.50 stays as string)
- Loss of plus signs (+123 stays as string)
- Changes in notation (1e10 stays as string)

Only convert to numeric types when the string representation would be
preserved exactly. This maintains data integrity while still providing
convenient type conversions for clean numeric values.

Added comprehensive tests to verify the safety check behavior.
2025-07-21 16:43:39 +02:00
e6db26d2c4 Improve basic example to showcase all resolver types
- Replace simple ENV-only example with diverse resolver showcase
- Add GCP Secret Manager, AWS Secrets Manager, Vault examples in main config
- Add JSON resolver example for loading service configs and feature flags
- Add Consul, K8S, and FILE resolvers for different config aspects
- Include example JSON files to show what JSON resolver references
- Update Go code to demonstrate accessing the various config types
- Move away from env-centric example to show full power upfront
2025-07-21 16:21:33 +02:00
81eddf2b38 Update README for 1.0 release
- Add table of contents for easier navigation
- Move key features to the top
- Add comprehensive examples demonstrating all features
- Fix incorrect Get() method documentation (only supports top-level keys)
- Document authentication requirements for all cloud providers
- Add complete production-ready example with all resolvers
- Add security considerations section
- Improve clarity throughout with better organization
- Ensure all examples are accurate and tested
2025-07-21 16:07:18 +02:00
cf13b275b7 Squashed commit of the following:
commit e15edaedd786254cf22c291a63a02f7cff33b119
Author: sneak <sneak@sneak.berlin>
Date:   Mon Jul 21 15:17:12 2025 +0200

    Implement YAML-first interpolation with type preservation

    Previously, interpolations were performed during string manipulation before
    YAML parsing, which caused issues with quoting and escaping. This commit
    fundamentally changes the approach:

    - Parse YAML first, then walk the structure to interpolate values
    - Preserve types: standalone interpolations can return numbers/booleans
    - Mixed content (text with embedded interpolations) always returns strings
    - Users control types through YAML syntax, not our quoting logic
    - Properly handle nested interpolations without quote accumulation

    This gives users explicit control over output types while eliminating
    the complex and error-prone manual quoting logic.
2025-07-21 15:19:28 +02:00
3c3732f033 Add JSON5 support, --json CLI flag, typed getters, and improve YAML quoting
- Updated JSON resolver to use gjson library for JSON5 support (comments, trailing commas)
- Added --json flag to CLI tool for JSON output format
- Added typed getter methods: GetInt(), GetUint(), GetFloat(), GetBool(), GetBytes()
- GetBytes() supports human-readable formats like "10G", "20KiB" via go-humanize
- Fixed YAML interpolation to always quote output values for safety
- Updated README to clarify YAML-only input and automatic quoting behavior
- Added .gitignore to exclude compiled binary
- Fixed test config files to use unquoted interpolation syntax
- Updated tests to expect quoted interpolation output
2025-07-21 12:13:14 +02:00
8a38afba5e passes tests, has cli filter now.
* still has not been *really* tested yet
2025-07-20 15:29:06 +02:00
971068ea03 initial 2025-07-20 12:12:14 +02:00