@@ -55,7 +55,7 @@ No custom error handling. No secret leaks in logs. Types are checked at compile
5555✅ ** Secret redaction** — mark sensitive fields with ` secret:"true" ` , they're automatically hidden
5656✅ ** Multiple sources** — load from YAML, env, JSON, TOML, Kubernetes, AWS, Vault with explicit precedence
5757✅ ** Lightweight** — only 2 core dependencies, cloud integrations are optional modules
58- ✅ ** Production-ready** — v0.9 .0 with full test coverage, used in real services
58+ ✅ ** Production-ready** — v1.0 .0 with full test coverage and API stability guarantee
5959
6060``` go
6161type Config struct {
@@ -145,14 +145,14 @@ go get github.com/MimoJanra/confkit/aws@latest
145145
146146---
147147
148- ## Breaking Changes in v0.10 .0
148+ ## Breaking Changes in v1.0 .0
149149
150150** ` Load[T] ` now returns ` (*T, error) ` instead of ` (T, error) ` (pointer)**
151151
152152This aligns with Go idioms for larger configs. Go automatically dereferences pointers for field access, so most code works unchanged:
153153
154154``` go
155- // v0.10 + — works exactly the same
155+ // v1.0 + — works exactly the same
156156cfg , err := confkit.Load [Config](confkit.FromEnv ())
157157log.Printf (" Port: %d " , cfg.Port ) // auto-dereference, works fine
158158```
@@ -319,10 +319,16 @@ Built-in sources — pass any combination, first one to provide a value wins per
319319
320320``` go
321321confkit.FromYAML (path string ) Source
322+ confkit.FromYAMLOptional (path string ) Source
323+ confkit.FromYAMLFiles (paths ...string ) Source
322324confkit.FromJSON (path string ) Source
325+ confkit.FromJSONFiles (paths ...string ) Source
323326confkit.FromTOML (path string ) Source
327+ confkit.FromTOMLFiles (paths ...string ) Source
324328confkit.FromEnv () Source
325329confkit.FromFlags () Source
330+ confkit.FromFlagsWithArgs (args []string ) Source
331+
326332```
327333
328334Optional sources (separate ` go get ` per module):
@@ -347,10 +353,10 @@ etcd.FromEtcdWithPrefix(endpoints []string, prefix string) confkit.Source
347353
348354// go get confkit/aws
349355aws.FromAWSSSMParameterStore (pathPrefix string ) confkit.Source
350- aws.FromAWSSSMParameterStoreWithTTL (pathPrefix string , ttl time.Duration ) confkit.Source
356+ aws.FromAWSSSMParameterStoreWithTTL (pathPrefix string , cacheTTL time.Duration ) confkit.Source
351357aws.FromAWSSecretsManager (secretName string ) confkit.Source
352358aws.FromAWSSecretsManagerWithRegion (secretName, region string ) confkit.Source
353- aws.FromAWSSecretsManagerWithOptions (secretName, region string , ttl time.Duration ) confkit.Source
359+ aws.FromAWSSecretsManagerWithOptions (secretName, region string , cacheTTL time.Duration ) confkit.Source
354360aws.FromAWSSecretsManagerMultiRegion (secretName string , regions []string ) confkit.Source
355361aws.FromAWSSSMParameterStoreMultiRegion (pathPrefix string , regions []string ) confkit.Source
356362```
@@ -408,15 +414,25 @@ func Load[T any](sources ...Source) (*T, error)
408414
409415// Load with fine-grained options (validators, middleware, interpolation depth)
410416func LoadWithOptions [T any](options ...Option ) (*T, error )
417+ func LoadContext [T any](ctx context.Context , sources ...Source ) (*T, error )
418+ func LoadWithOptionsContext [T any](ctx context.Context , options ...Option ) (*T, error )
419+ func ValidateOnly [T any](ctx context.Context , options ...Option ) (*T, error )
420+ func MustLoad [T any](sources ...Source ) *T
421+ func MustLoadContext [T any](ctx context.Context , sources ...Source ) *T
411422
412423// Load and set up a file watcher in one call
413424func LoadWithWatcher [T any](filePath string , sources ...Source ) (*T, *ConfigWatcher, error )
414425
415426// Option constructors
416427func WithSource (source Source ) Option
417- func WithValidator(name string, fn func(reflect.Value) error) Option
428+ func WithValidator(name string, fn func (reflect.Value) error) Option
429+ func WithModelValidator[T any](fn func (*T) error) Option
418430func WithMiddleware(fn MiddlewareFunc) Option
431+ func WithAuditLogger(fn AuditLogger) Option
432+ func WithLoadHook(fn LoadHookFunc) Option
433+ func WithContext(ctx context.Context) Option
419434func WithInterpolationMaxDepth(depth int) Option
435+
420436```
421437
422438---
@@ -459,7 +475,8 @@ type Config struct {
459475}
460476```
461477
462- - Error messages show ` <redacted> ` instead of the value
478+ - Error messages show ` <redacted> ` for secret fields
479+ - Validation values are redacted as ` ***REDACTED*** `
463480- ` DumpConfig ` substitutes ` "***REDACTED***" `
464481- Safe to log the output of ` Explain(err) ` and ` DumpConfig ` without leaking credentials
465482
@@ -587,9 +604,12 @@ type Source interface {
587604// FieldInfo fields available to your Lookup implementation:
588605// .Name string — "Password"
589606// .Path string — "Database.Password"
607+ // .Type reflect.Type
608+ // .Value reflect.Value
590609// .Tags map[string]string — all struct tags
591610// .IsSecret bool
592611// .HasDefault bool
612+ // .IsNested bool
593613// .AncestorTags []map[string]string — tags of parent structs
594614
595615// Helper for returning a permanently-errored source (e.g. from a constructor):
@@ -614,6 +634,15 @@ md := schema.GenerateMarkdown[Config]()
614634help := schema.GenerateCLIHelp[Config]()
615635```
616636
637+
638+ ## Safe Dump API
639+
640+ ```go
641+ func Dump[T any](cfg T, opts ...DumpOption) ([]byte, error)
642+ func DumpString[T any](cfg T, opts ...DumpOption) string
643+ func DumpYAML[T any](cfg T, opts ...DumpOption) ([]byte, error)
644+ ```
645+
617646---
618647
619648## Supported Types
@@ -626,6 +655,7 @@ help := schema.GenerateCLIHelp[Config]()
626655| `float32` / `float64` | decimal |
627656| `bool` | `true` `false` `1` `0` `yes` `no` |
628657| `time.Duration` | `"5s"` `"1m30s"` `"2h"` |
658+ | `time.Time` | RFC3339 `"2006-01-02T15:04:05Z07:00"` |
629659| `[]string` | comma-separated `"a,b,c"` |
630660| `[]int` | comma-separated `"1,2,3"` |
631661| `map[string]string` / `map[string]int` etc. | `KEY=val,KEY2=val2` format |
0 commit comments