And another one from @chrismccord himself:
you could make a plug that calls the Plug.Session init, at runtime
plug MySession, ... defmodule MySession do def init(opts), do: Plug.Sesson.init(opts) def call(conn, opts) do runtime_opts = Keyword.put(opts, :domain, ...) Plug.Session.call(conn, runtime_opts) end end
in this case, I kept init at compiletime, but modified the options before calling the session plug, to do as much work as possible at compile time
but you get the idea? The plug could have just beenPlug.Session.call(conn, Plug.Session.init(opts))