DatabaseUrl
Parse database URL and renturn keyword list for use with Ecto.
Installation
defp deps do
[ {:database_url, "~> 0.1"}, ]
endUsage
API
iex> url = "postgres://localhost/database?size=30&ssl=true&encoding=utf-8"
iex> options = DatabaseUrl.parse(url)
[host: "localhost", database: "database", adapter: Ecto.Adapters.Postgres,
size: 30, ssl: true, encoding: "utf-8"]Use with Phoenix + Ecto
Use in project config and assume DATABASE_URL environment variable is set.
# Configure your database
config :myapp, MyApp.Repo, DatabaseUrl.parse(System.get_env("DATABASE_URL"))