env
env copied to clipboard
Support prefixes for environment variable lookups
Hello, I love how simple the interface of this library is, the only thing I find missing is the ability to include a prefix in the lookup. This would allow reusable structs with different environment "namespaces".
For example:
type test struct {
Lorem string `env:"lorem"`
Ipsum string `env:"ipsum"`
}
var (
foo test
bar test
)
func main() {
env.Set(&foo, "FOO_")
env.Set(&bar, "BAR_")
}
I will open pull request ready with a functional change, would just need some guidance on appropriate tests.