ha-handler/lib/ha_handler/web/controller.ex

19 lines
329 B
Elixir

defmodule HAHandler.Web.Controller do
import Plug.Conn
alias HAHandler.HAProxy
def index(conn) do
{:ok, hostname} = :inet.gethostname()
stats = HAProxy.get_stats()
reply = "OK #{hostname}"
<> "\nPROXY: "
<> inspect(stats)
conn
|> put_resp_content_type("text/plain")
|> send_resp(200, reply)
end
end