Skip to content

:on_init is no longer supported

Getting the following message after setting up a test instance:

16:37:08.101 [warn] The :on_init configuration in Pleroma.Web.Endpoint introduced in Phoenix v1.3.0-rc
is no longer supported and won't be invoked. Instead, use the init/2 callback,
which is always called. In your config/prod.exs, instead of :on_init, set:

    load_from_system_env: true

and then in Pleroma.Web.Endpoint:

    def init(_key, config) do
      if config[:load_from_system_env] do
        port = System.get_env("PORT") || raise "expected the PORT environment variable to be set"
        {:ok, Keyword.put(config, :http, [:inet6, port: port])}
      else
        {:ok, config}
      end
    end

@feld told me in matrix to comment out the line on_init: {Pleroma.Web.Endpoint, :load_from_system_env, []}, in prod.exs, which removed the message. Because he forgot to open a problem, I did is here :)