github.com/sxwebdev/xconfig
Package xconfig provides a lightweight, zero-dependency, and highly extensible configuration management library for Go applications. xconfig enables you to build type-safe configuration for your applications using a plugin-based architecture. Mix and match only the configuration sources you need: defaults, environment variables, command-line flags, configuration files, secret providers, and more. Define your configuration as a struct with tags: Load configuration from multiple sources: The Load function automatically processes configuration in this order: ## Default Values Use the "default" tag to specify default values: ## Environment Variables Use the "env" tag to bind fields to environment variables: Add a prefix to all environment variables: ## Command-Line Flags Use the "flag" tag to bind fields to command-line flags: ## Configuration Files Load configuration from JSON, YAML, TOML, or any other format: ## Custom Defaults Implement SetDefaults() for programmatic default values: Use the secret plugin to load sensitive data from secret providers like AWS Secrets Manager, HashiCorp Vault, or Kubernetes secrets: Add validation by implementing the Validate() method: Or use external validators with the validate plugin: The following struct tags are supported: xconfig supports all basic Go types, time.Duration, slices of basic types, and any type implementing encoding.TextUnmarshaler: Create custom plugins by implementing the Plugin interface with either Walker or Visitor: Generate markdown documentation for your configuration: Control which plugins are enabled: For more information and examples, see: https://github.com/sxwebdev/xconfig Package xconfig provides advanced command line flags supporting defaults, env vars, and config structs.
proxy.golang.org
v0.3.1
about 1 month ago
10
Links
| Registry | proxy.golang.org |
| Source | Repository |
| Docs | Documentation |
| JSON API | View JSON |
| CodeMeta | codemeta.json |
Package Details
| PURL |
pkg:golang/github.com/sxwebdev/xconfig
spec |
| License | MIT |
| Namespace | github.com/sxwebdev |
| First Release | 4 months ago |
| Last Synced | 26 days ago |