Skip to content

Commit

Permalink
Call System.cmd during config
Browse files Browse the repository at this point in the history
  • Loading branch information
nkezhaya committed Oct 15, 2019
1 parent 5d56835 commit e19d2ed
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
12 changes: 12 additions & 0 deletions config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,18 @@ config :logger, :console,
# Use Jason for JSON parsing in Phoenix
config :phoenix, :json_library, Jason

{uri, _} = System.cmd("pg_tmp", ["-t"])
[_, port] = Regex.scan(~r/\:(\d+)\//, uri) |> List.flatten()

config :stripe_mock, StripeMock.Repo,
adapter: Ecto.Adapters.Postgres,
username: "postgres",
password: "postgres",
database: "test",
hostname: "localhost",
port: port,
pool_size: 10

# Import environment specific config. This must remain at the bottom
# of this file so it overrides the configuration defined above.
import_config "#{Mix.env()}.exs"
12 changes: 0 additions & 12 deletions lib/stripe_mock/repo.ex
Original file line number Diff line number Diff line change
@@ -1,16 +1,4 @@
defmodule StripeMock.Repo do
@moduledoc """
This is where we store everything. Obviously, don't call any of these
functions yourself.
State structure is:
%{
customer: %{
"cus_123123" => %Customer{}
}
}
"""
use GenServer
import Ecto.Changeset
alias Ecto.Changeset
Expand Down

0 comments on commit e19d2ed

Please sign in to comment.