Packages
plug_maintenance
0.1.0
An Elixir plug returns a service unavailable response during maintenance.
Current section
Files
Jump to
Current section
Files
lib/monitor.ex
defmodule PlugMaintenance.Monitor do
@env "MAINTENANCE"
@file "maintenance"
def check(_conn, _opts) do
cond do
has_environment_value? -> true
maintenance_file_exists? -> true
true -> false
end
end
defp has_environment_value? do
System.get_env(@env) == "true"
end
defp maintenance_file_exists? do
File.exists?("maintenance")
end
end