mobilizon.chapril.org-mobil.../lib/mobilizon/common-config.ex

26 lines
514 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
def instance_description() do
instance_config()
|> get_in([:description])
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