Skip to content

Instantly share code, notes, and snippets.

@AndrewDryga
Last active August 22, 2017 10:17
Show Gist options
  • Save AndrewDryga/7da8b13c306be5619ba2310142ba14ba to your computer and use it in GitHub Desktop.
Save AndrewDryga/7da8b13c306be5619ba2310142ba14ba to your computer and use it in GitHub Desktop.
Ecto init callback example
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