Trying to use URL of local postgres Repo to post

I’m trying to connect to a local postgres repository using its UR, then post a query to this repo. I’m not sure how the URL name is to be configure. The error I get is:

{:error, %HTTPoison.Error{id: nil, reason: :nxdomain}}

My dev.exs is:

config :valiot_app, :repo_helper, %{
  url: "ecto://postgres:postgres@localhost/my_repo",
  header: %{
    authorization:
      "Bearer eyJhbGciOiJIUzUxMiIs9..."
  }
}

The post that it’s trying to do:

@url Application.get_env(:valiot_app, :repo_helper).url
@header Application.get_env(:valiot_app, :repo_helper).header

{:ok, response} = HTTPoison.post(@url, body, @header)

Am I lacking in configuration?

You cannot talk to a Postgres DB over HTTP, try connecting to it using Ecto Repo instead.

1 Like

Well there are plugins for PostgreSQL to do that, but not using the ecto setup at all. ^.^;

1 Like