debianize-mobilizon/lib/mobilizon/common-config.ex

21 lines
423 B
Elixir
Raw Normal View History

2019-03-22 10:53:38 +01:00
defmodule Mobilizon.CommonConfig do
@moduledoc """
Instance configuration wrapper
"""
2019-03-22 10:53:38 +01:00
def registrations_open?() do
instance_config()
|> get_in([:registrations_open])
|> to_bool
end
def instance_name() do
instance_config()
|> get_in([:name])
end
2019-03-22 10:53:38 +01:00
defp instance_config(), do: Application.get_env(:mobilizon, :instance)
defp to_bool(v), do: v == true or v == "true" or v == "True"
2019-03-22 10:53:38 +01:00
end