yesodweb / yesodweb/persistent
connectionString support in `FromJSON` for `PostgresConf`
Nobody has claimed this yet.
- Dominant language
- Haskell
- Stars
- 486
- Forks
- 306
- PR merge metrics
- No merged PRs in 30d
Description
Would the maintainers be open to a PR expanding the FromJSON implementation for PostgresConf so that it accepts a connectionString value as an alternative to passing database, host, port, user, and password individually?
I generated a new Yesod application using stack new foo yesodweb/postgres, and the first thing I wanted to do was get the generated code up and running on Heroku. Heroku provides the postgres connection string as a single environment variable in a libpq-compatible format, so it would be convenient to be able to pass that same value straight through to the configuration. Since the template-generated starter code from stack new uses the FromJSON implementation for PostgresConf as the basis for configuration with environment variables, it seems like expanding the FromJSON implementation would be a sensible way to add connectionString support.
I worked around this with newtype to get something working in my own app. I'd be happy to submit a PR with the FromJSON changes.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the FromJSON implementation for PostgresConf and the template-generated configuration path described in the issue. Compare its existing field parsing with the requested connectionString input, then add coverage showing that a libpq-compatible value is accepted while existing individual fields continue to work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell, postgresql
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100