@@ -100,18 +100,21 @@ export MYAPP_NAME="My Application" # → string
100100```
101101
102102Environment variable naming:
103+
103104- Prefix: Uppercase version of config name (or custom ` env_prefix ` )
104105- Nested keys: Separated by underscores
105106- Hyphens: Converted to underscores
106107
107108Examples:
109+
108110- ` database.host ` → ` MYAPP_DATABASE_HOST `
109111- ` api-key ` → ` MYAPP_API_KEY `
110112- ` cache.ttl-seconds ` → ` MYAPP_CACHE_TTL_SECONDS `
111113
112114## Type Safety Features
113115
114116### ✅ Compile-Time Type Checking
117+
115118- ** No runtime type errors** - all types validated at compile time
116119- ** IDE autocomplete** - full IntelliSense support for config fields
117120- ** Default values** - define defaults directly in your struct
@@ -203,7 +206,7 @@ const Config = struct {
203206
204207var config = try zig_config.loadConfig(Config, allocator, .{
205208 .name = "myapp",
206- .env_prefix = "CUSTOM", // Uses CUSTOM_* instead of MYAPP_ *
209+ .env_prefix = "CUSTOM", // Uses CUSTOM** instead of MYAPP* *
207210});
208211defer config.deinit(allocator);
209212```
@@ -242,24 +245,27 @@ pub fn main() !void {
242245### Merge Strategies
243246
244247#### Replace (default for primitives/arrays)
248+
245249``` zig
246250.{ .strategy = .replace }
247251// Arrays are completely replaced
248252// [1, 2] + [3, 4] = [3, 4]
249253```
250254
251255#### Concat (for arrays)
256+
252257``` zig
253258.{ .strategy = .concat }
254259// Arrays are concatenated with deduplication
255260// [1, 2] + [2, 3] = [1, 2, 3]
256261```
257262
258263#### Smart (for object arrays)
264+
259265``` zig
260266.{ .strategy = .smart }
261267// Object arrays are merged by key (id, name, key, path, type)
262- // [{"id": 1, "name": "a"}] + [{"id": 1, "name": "b"}]
268+ // [{"id": 1, "name": "a"}] + [{"id": 1, "name": "b"}]
263269// = [{"id": 1, "name": "b"}] // merged by id
264270```
265271
@@ -346,6 +352,7 @@ All 20 tests passing! Note: There are 4 known memory "leaks" from Zig's JSON par
346352### Main Functions
347353
348354#### ` loadConfig `
355+
349356``` zig
350357pub fn loadConfig(
351358 comptime T: type,
@@ -357,6 +364,7 @@ pub fn loadConfig(
357364Load configuration with full error handling. Returns a typed result.
358365
359366#### ` tryLoadConfig `
367+
360368``` zig
361369pub fn tryLoadConfig(
362370 comptime T: type,
@@ -368,6 +376,7 @@ pub fn tryLoadConfig(
368376Load configuration, returning ` null ` on error.
369377
370378#### ` deepMerge `
379+
371380``` zig
372381pub fn deepMerge(
373382 allocator: std.mem.Allocator,
415424## Contributing
416425
417426Contributions welcome! Please ensure:
427+
418428- All tests pass (` zig build test ` )
419429- Code follows Zig style guidelines
420430- New features include tests
0 commit comments