Last active
August 22, 2017 10:17
-
-
Save AndrewDryga/7da8b13c306be5619ba2310142ba14ba to your computer and use it in GitHub Desktop.
Ecto init callback example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule MyAppAPI.Repo do | |
use Ecto.Repo, otp_app: :myapp_api | |
def init(_type, config) do | |
url = System.get_env("DATABASE_URL") | |
if url, do: {:ok, [url: url] ++ config}, else: {:ok, config} | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment