dozer icon indicating copy to clipboard operation
dozer copied to clipboard

Postgres configuration specification is confusing

Open v3g42 opened this issue 2 years ago • 1 comments

https://github.com/getdozer/dozer/blob/main/dozer-types/src/models/connection.rs#L94 PostgresConfig seems to take each field optionally. It should rather be two variations. Either you specify a URL or all mandatory fields specified.

v3g42 avatar Sep 24 '23 08:09 v3g42

Expected flow:

  1. when user specify PostgresConfig with connection_url we only takes details from the url only
  config: !Postgres
      connection_url: postgres://postgres:postgres@localhost:5432/dozer
  • if the connection_url is provided with other mandatory fields manually, we give out error saying Either you specify connection URL or all mandatory fields.
  config: !Postgres
      connection_url: postgres://postgres:postgres@localhost:5432/dozer
      user: postgres
  1. when user doesn't specify connection_url in PostgresConfig, we try taking details from other mandatory fields, if missing data, we give out error with Missing details for postgres connection config - <fields>
  config: !Postgres
      user: postgres
      password: postgres
      host: localhost
      port: 5432
      database: dozer
      name: user

chloeminkyung avatar Sep 24 '23 11:09 chloeminkyung