{"action":"created","issue":{"url":"https://api.github.com/repos/robconery/moebius/issues/33","labels_url":"https://api.github.com/repos/robconery/moebius/issues/33/labels{/name}","comments_url":"https://api.github.com/repos/robconery/moebius/issues/33/comments","events_url":"https://api.github.com/repos/robconery/moebius/issues/33/events","html_url":"https://github.com/robconery/moebius/issues/33","id":117477849,"number":33,"title":"Support `url` as a way to connect ","user":{"login":"taylorbrooks","id":117657,"avatar_url":"https://avatars.githubusercontent.com/u/117657?v=3","gravatar_id":"","url":"https://api.github.com/users/taylorbrooks","html_url":"https://github.com/taylorbrooks","followers_url":"https://api.github.com/users/taylorbrooks/followers","following_url":"https://api.github.com/users/taylorbrooks/following{/other_user}","gists_url":"https://api.github.com/users/taylorbrooks/gists{/gist_id}","starred_url":"https://api.github.com/users/taylorbrooks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/taylorbrooks/subscriptions","organizations_url":"https://api.github.com/users/taylorbrooks/orgs","repos_url":"https://api.github.com/users/taylorbrooks/repos","events_url":"https://api.github.com/users/taylorbrooks/events{/privacy}","received_events_url":"https://api.github.com/users/taylorbrooks/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"xivSolutions","id":853147,"avatar_url":"https://avatars.githubusercontent.com/u/853147?v=3","gravatar_id":"","url":"https://api.github.com/users/xivSolutions","html_url":"https://github.com/xivSolutions","followers_url":"https://api.github.com/users/xivSolutions/followers","following_url":"https://api.github.com/users/xivSolutions/following{/other_user}","gists_url":"https://api.github.com/users/xivSolutions/gists{/gist_id}","starred_url":"https://api.github.com/users/xivSolutions/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xivSolutions/subscriptions","organizations_url":"https://api.github.com/users/xivSolutions/orgs","repos_url":"https://api.github.com/users/xivSolutions/repos","events_url":"https://api.github.com/users/xivSolutions/events{/privacy}","received_events_url":"https://api.github.com/users/xivSolutions/received_events","type":"User","site_admin":false},"milestone":null,"comments":4,"created_at":"2015-11-17T23:45:59Z","updated_at":"2015-11-18T00:40:39Z","closed_at":null,"body":"Ecto allows you to connect to a db using the url like so:\r\n\r\n```elixir\r\nconfig :drip_emails, DripEmails.Repo,                        \r\n  adapter: Ecto.Adapters.Postgres,                           \r\n  url: System.get_env(\"DATABASE_URL\"),                       \r\n  size: 20 # The amount of database connections in the pool\r\n```\r\n\r\nIt would be great to connect to PG this way instead of having to specify the options individually.\r\n\r\nHere's where this happens in Ecto:\r\n\r\nhttps://github.com/elixir-lang/ecto/blob/e26f3173936097d63b96bda4e821a387e8a6b5c6/lib/ecto/repo/supervisor.ex#L73-L100\r\n```elixir\r\ndef parse_url(\"\"), do: []\r\n\r\ndef parse_url({:system, env}) when is_binary(env) do\r\n  parse_url(System.get_env(env) || \"\")\r\nend\r\n\r\ndef parse_url(url) when is_binary(url) do\r\n  info = url |> URI.decode() |> URI.parse()\r\n\r\n  if is_nil(info.host) do\r\n    raise Ecto.InvalidURLError, url: url, message: \"host is not present\"\r\n  end\r\n\r\n  if is_nil(info.path) or not (info.path =~ ~r\"^/([^/])+$\") do\r\n    raise Ecto.InvalidURLError, url: url, message: \"path should be a database name\"\r\n  end\r\n\r\n  destructure [username, password], info.userinfo && String.split(info.userinfo, \":\")\r\n  \"/\" <> database = info.path\r\n\r\n  opts = [username: username,\r\n          password: password,\r\n          database: database,\r\n          hostname: info.host,\r\n          port:     info.port]\r\n\r\n  Enum.reject(opts, fn {_k, v} -> is_nil(v) end)\r\nend\r\n```"},"comment":{"url":"https://api.github.com/repos/robconery/moebius/issues/comments/157558793","html_url":"https://github.com/robconery/moebius/issues/33#issuecomment-157558793","issue_url":"https://api.github.com/repos/robconery/moebius/issues/33","id":157558793,"user":{"login":"nurugger07","id":353129,"avatar_url":"https://avatars.githubusercontent.com/u/353129?v=3","gravatar_id":"","url":"https://api.github.com/users/nurugger07","html_url":"https://github.com/nurugger07","followers_url":"https://api.github.com/users/nurugger07/followers","following_url":"https://api.github.com/users/nurugger07/following{/other_user}","gists_url":"https://api.github.com/users/nurugger07/gists{/gist_id}","starred_url":"https://api.github.com/users/nurugger07/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nurugger07/subscriptions","organizations_url":"https://api.github.com/users/nurugger07/orgs","repos_url":"https://api.github.com/users/nurugger07/repos","events_url":"https://api.github.com/users/nurugger07/events{/privacy}","received_events_url":"https://api.github.com/users/nurugger07/received_events","type":"User","site_admin":false},"created_at":"2015-11-18T00:40:39Z","updated_at":"2015-11-18T00:40:39Z","body":"@taylorbrooks are you going add this? If you want we can work on it tomorrow."}}