Activate / Deactivate scopes in router from config

Found a way, I did a specific plug that checks the variable in the config file :

def call(conn, _default) do
  if Application.get_env(:api, ApiWeb.Endpoint)[:hasAccess] do
     conn
  else
     send_resp(conn, 403, "You do not have access.")
     |> halt()
  end
end

Then I just call this plug in a pipeline in the router and I tell my scope to run through the pipeline.

Thanks a lot for the suggestion.