Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What is the proper way of grouping env vars into product Haskell types? #46

Open
coderfromhere opened this issue Oct 7, 2021 · 0 comments

Comments

@coderfromhere
Copy link

Hi! I'd like to know what is the proper way to group multiple independent env vars prefixed with a component name into a Haskell component structure that represent the component as a whole? Basically I want these vars

DB_NAME=
DB_PORT=

to be mapped into a single data DbSettings ..., so that DbSettings itself can be used in larger env var parsers like:

data AppSettings = AppSettings
    { something :: Text
    , dbSettings :: DbSettings
    }

Normally, I'd first define an instance of Var a, but fromVar is only provided with a single variable, not a set of items. Does it mean that I should omit declaring instances for Var a and proceed with manual parsing inside instances of FromEnv a?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant