Skip to content

Commit

Permalink
add postgres/ecto conf
Browse files Browse the repository at this point in the history
Signed-off-by: rodesousa <[email protected]>
  • Loading branch information
rodesousa committed Sep 22, 2021
1 parent e305152 commit bfe461c
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
postgres_run:
@docker run -it -d --name pex_db -p 5432:5432 -e POSTGRES_USER=user -e POSTGRES_PASSWORD=dev postgres

postgres_start:
@docker start pex_db

postgres_rm:
@docker rm -f pex_db
9 changes: 9 additions & 0 deletions config/config.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import Config

config :pex, Pex.Repo,
database: "pex_repo",
username: "user",
password: "dev",
hostname: "localhost"

config :pex, ecto_repos: [Pex.Repo]
1 change: 1 addition & 0 deletions lib/pex/application.ex
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ defmodule Pex.Application do
@impl true
def start(_type, _args) do
children = [
Pex.Repo
# Starts a worker by calling: Pex.Worker.start_link(arg)
# {Pex.Worker, arg}
]
Expand Down
5 changes: 5 additions & 0 deletions lib/pex/repo.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
defmodule Pex.Repo do
use Ecto.Repo,
otp_app: :pex,
adapter: Ecto.Adapters.Postgres
end

0 comments on commit bfe461c

Please sign in to comment.