Merge remote-tracking branch 'origin/develop' into feature/bbs
[akkoma] / lib / pleroma / repo.ex
1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
4
5 defmodule Pleroma.Repo do
6 use Ecto.Repo,
7 otp_app: :pleroma,
8 adapter: Ecto.Adapters.Postgres,
9 migration_timestamps: [type: :naive_datetime_usec]
10
11 defmodule Instrumenter do
12 use Prometheus.EctoInstrumenter
13 end
14
15 @doc """
16 Dynamically loads the repository url from the
17 DATABASE_URL environment variable.
18 """
19 def init(_, opts) do
20 {:ok, Keyword.put(opts, :url, System.get_env("DATABASE_URL"))}
21 end
22 end