Skip to content

Support for separating the names of nested structs with a double underscore #223

@brianmaissy

Description

@brianmaissy

It would be nice if envconfig supported environment variable names of the form:
MYAPP__DATABASE__USER_NAME as opposed to MYAPP_DATABASE_USERNAME or MYAPP_DATABASE_USER_NAME.

Of course it would be opt-in and the default behavior would not change, to preserve backwards compatibility.

This would work well together with #190.

Part of my motivation here is to make it clearer where the nested namespaces break when using split_words, and part is to be consistent with many other tools across a variety of frameworks and languages which use a double underscore to represent hierarchical nesting (I'm using envconfig in Go services in a polyglot microservices architecture).

I'm pretty new to the Go ecosystem, but I'd be willing to try to contribute a PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions