2019-03-22 10:53:38 +01:00
|
|
|
defmodule Mobilizon.CommonConfig do
|
2019-03-22 13:58:19 +01:00
|
|
|
@moduledoc """
|
|
|
|
Instance configuration wrapper
|
|
|
|
"""
|
2019-03-22 10:53:38 +01:00
|
|
|
|
2019-03-22 13:58:19 +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)
|
2019-03-22 13:58:19 +01:00
|
|
|
|
|
|
|
defp to_bool(v), do: v == true or v == "true" or v == "True"
|
2019-03-22 10:53:38 +01:00
|
|
|
end
|