mobilizon/lib/service/front_end_analytics/matomo.ex
Thomas Citharel e3adc0684f
Make FrontEndAnalytics provide CSP configuration
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
2022-04-06 19:56:09 +02:00

41 lines
841 B
Elixir

defmodule Mobilizon.Service.FrontEndAnalytics.Matomo do
@moduledoc """
Matomo analytics provider
"""
alias Mobilizon.Service.FrontEndAnalytics
@behaviour FrontEndAnalytics
@impl FrontEndAnalytics
def id, do: "matomo"
@doc """
Whether the service is enabled
"""
@impl FrontEndAnalytics
def enabled? do
:mobilizon
|> Application.get_env(__MODULE__, [])
|> Keyword.get(:enabled, false)
end
@doc """
The configuration for the service
"""
@impl FrontEndAnalytics
def configuration do
:mobilizon
|> Application.get_env(__MODULE__, [])
|> Keyword.drop([:enabled, :csp])
end
@doc """
The CSP configuration to add for the service to work
"""
@impl FrontEndAnalytics
def csp do
:mobilizon
|> Application.get_env(__MODULE__, [])
|> Keyword.get(:csp, [])
end
end