Don't rely on Mix.env check in runtime (#2703)

This commit is contained in:
Adam Rutkowski 2023-02-23 10:35:46 +01:00 committed by GitHub
parent 043e3ed572
commit 7dec454a23
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -96,8 +96,7 @@ defmodule PlausibleWeb.StatsController do
query = Query.from(site, params) |> Filters.add_prefix()
visits_metric_enabled =
FunWithFlags.enabled?(:visits_metric, for: conn.assigns[:current_user]) ||
Mix.env() == :test
FunWithFlags.enabled?(:visits_metric, for: conn.assigns[:current_user])
metrics =
if visits_metric_enabled && !query.filters["event:goal"] do

View File

@ -1,6 +1,7 @@
{:ok, _} = Application.ensure_all_started(:ex_machina)
Plausible.Test.ClickhouseSetup.run()
Mox.defmock(Plausible.HTTPClient.Mock, for: Plausible.HTTPClient.Interface)
FunWithFlags.enable(:visits_metric)
ExUnit.start(exclude: :slow)
Application.ensure_all_started(:double)
Ecto.Adapters.SQL.Sandbox.mode(Plausible.Repo, :manual)