'mix ecto.create' errors with: role "postgres" does not exist

Got the same issue with PostgreSQL on macOS installed from brew.
Resolved with the next config:

config :p_core, PCore.Repo,
  username: System.cmd("whoami", [])
            |> elem(0)
            |> String.trim(),
  database: "p_core_dev",
  hostname: "localhost",
  show_sensitive_data_on_connection_error: true,
  pool_size: 10