Packages

Curtains is a Elixir package that "takes over" your Elixir website by returning content of a specified file (if it exists). This makes it perfect for "Under construction" and "Maintenance" pages. At it's heart, it's just a Plug.

Current section

Files

Jump to
curtains lib curtains.ex
Raw

lib/curtains.ex

defmodule Curtains do
import Plug.Conn
def init(_opts) do
end
def call(conn, _opts) do
file = Application.get_env(:curtains, :curtain_file)
case File.read(file) do
{:ok, binary } ->
conn
|> put_resp_content_type("text/html")
|> send_resp(200, binary)
|> halt
{:error, reason } ->
IO.inspect reason
conn
end
end
end