Security News
PyPI Now Supports iOS and Android Wheels for Mobile Python Development
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
github.com/JeremyLoy/config
Manage your application config as a typesafe struct in as little as two function calls.
type MyConfig struct {
DatabaseUrl string `config:"DATABASE_URL"`
FeatureFlag bool `config:"FEATURE_FLAG"`
Port int // tags are optional. PORT is assumed
...
}
var c MyConfig
err := config.FromEnv().To(&c)
It's just simple, pure stdlib.
A field's type determines what strconv function is called.
All string conversion rules are as defined in the strconv package
time.Duration
follows the same parsing rules as time.ParseDuration
*net.URL
follows the same parsing rules as url.Parse
*net.URL
fields on the struct must be a pointerIf chaining multiple data sources, data sets are merged. Later values override previous values.
config.From("dev.config").FromEnv().To(&c)
Unset values remain intact or as their native zero value
Nested structs/subconfigs are delimited with double underscore
PARENT__CHILD
Env vars map to struct fields case insensitively
Any errors encountered are aggregated into a single error value
Opinionated and narrow in scope. This library is only meant to do config binding. Feel free to use it on its own, or alongside other libraries.
Only structs at the entry point. This keeps the API surface small.
Slices are space delimited. This matches how environment variables and commandline args are handled by the go
cmd.
No slices of structs. The extra complexity isn't warranted for such a niche usecase.
No maps. The only feature of maps not handled by structs for this usecase is dynamic keys.
No pointer members. If you really need one, just take the address of parts of your struct.
*url.URL
, which is explicitly a pointer for ease of use, matching the url
package conventionsFAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.