Merge pull request #6057 from betagouv/reduce_flipper_impact

Diminue l'impact de flipper sur les temps de réponse
This commit is contained in:
LeSim 2021-04-06 18:33:15 +02:00 committed by GitHub
commit f9c9a7c115
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 11 additions and 39 deletions

View file

@ -11,7 +11,7 @@ class ApplicationController < ActionController::Base
before_action :set_current_roles before_action :set_current_roles
before_action :set_sentry_user before_action :set_sentry_user
before_action :redirect_if_untrusted before_action :redirect_if_untrusted
before_action :reject, if: -> { feature_enabled?(:maintenance_mode) } before_action :reject, if: -> { ENV.fetch("MAINTENANCE_MODE", 'false') == 'true' }
before_action :configure_permitted_parameters, if: :devise_controller? before_action :configure_permitted_parameters, if: :devise_controller?
before_action :staging_authenticate before_action :staging_authenticate
@ -309,7 +309,7 @@ class ApplicationController < ActionController::Base
end end
def set_locale def set_locale
if feature_enabled?(:localization) if ENV.fetch('LOCALIZATION_ENABLED', 'false') == 'true'
I18n.locale = http_accept_language.compatible_language_from(I18n.available_locales) I18n.locale = http_accept_language.compatible_language_from(I18n.available_locales)
end end
end end

View file

@ -113,13 +113,7 @@ class APIEntreprise::API
end end
def self.url(resource_name, siret_or_siren) def self.url(resource_name, siret_or_siren)
base_url = [API_ENTREPRISE_URL, resource_name, siret_or_siren].join("/") [API_ENTREPRISE_URL, resource_name, siret_or_siren].join("/")
if Flipper.enabled?(:insee_api_v3)
base_url += "?with_insee_v3=true"
end
base_url
end end
def self.params(siret_or_siren, procedure_id, user_id) def self.params(siret_or_siren, procedure_id, user_id)

View file

@ -1,8 +0,0 @@
#strike-banner.site-banner
.container
.site-banner-icon ⚠️
.site-banner-text
%strong
En raison de lépidémie du coronavirus, les services fonctionnent en mode dégradé.
%br
Les délais de prise en charge des dossiers ou de réponses aux questions pourront être perturbés durant cette période.

View file

@ -3,14 +3,6 @@
- dossier = controller.try(:dossier_for_help) - dossier = controller.try(:dossier_for_help)
- procedure = controller.try(:procedure_for_help) - procedure = controller.try(:procedure_for_help)
-# only display the coronavirus to usagers (instructeurs know there are delays) when they are logged in, or on the public pages.
- if user_signed_in?
- if dossier.present? && dossier.procedure.feature_enabled?(:coronavirus_banner)
= render partial: 'layouts/coronavirus_banner'
- else
- if procedure.present? && procedure.feature_enabled?(:coronavirus_banner)
= render partial: 'layouts/coronavirus_banner'
%header.new-header{ class: current_page?(root_path) ? nil : "new-header-with-border", role: 'banner' } %header.new-header{ class: current_page?(root_path) ? nil : "new-header-with-border", role: 'banner' }
.header-inner-content .header-inner-content

View file

@ -23,9 +23,6 @@
= Gon::Base.render_data(camel_case: true, init: true, nonce: request.content_security_policy_nonce) = Gon::Base.render_data(camel_case: true, init: true, nonce: request.content_security_policy_nonce)
- if Rails.env.development? && feature_enabled?(:xray)
= stylesheet_link_tag :xray
%body{ id: content_for(:page_id), class: browser.platform.ios? ? 'ios' : nil } %body{ id: content_for(:page_id), class: browser.platform.ios? ? 'ios' : nil }
.page-wrapper .page-wrapper
= render partial: "layouts/outdated_browser_banner" = render partial: "layouts/outdated_browser_banner"
@ -43,7 +40,4 @@
- if content_for?(:footer) - if content_for?(:footer)
= content_for(:footer) = content_for(:footer)
- if Rails.env.development? && feature_enabled?(:xray)
= javascript_include_tag :xray
= yield :charts_js = yield :charts_js

View file

@ -77,7 +77,8 @@ module TPS
end end
config.middleware.use Rack::Attack config.middleware.use Rack::Attack
config.middleware.use Flipper::Middleware::Memoizer, preload_all: true config.middleware.use Flipper::Middleware::Memoizer,
preload: [:instructeur_bypass_email_login_token]
config.ds_env = ENV.fetch('DS_ENV', Rails.env) config.ds_env = ENV.fetch('DS_ENV', Rails.env)

View file

@ -67,3 +67,8 @@ DS_ENV="staging"
# Personnalisation d'instance - fichier utilisé pour poser un filigrane sur les pièces d'identité # Personnalisation d'instance - fichier utilisé pour poser un filigrane sur les pièces d'identité
# WATERMARK_FILE="" # WATERMARK_FILE=""
# Active le mode maintenance
# MAINTENANCE_MODE="true"
# Active la localisation
# LOCALIZATION_ENABLED="true"

View file

@ -28,18 +28,12 @@ features = [
:administrateur_routage, :administrateur_routage,
:administrateur_web_hook, :administrateur_web_hook,
:carte_ign, :carte_ign,
:coronavirus_banner,
:dossier_pdf_vide, :dossier_pdf_vide,
:expert_not_allowed_to_invite, :expert_not_allowed_to_invite,
:hide_instructeur_email, :hide_instructeur_email,
:insee_api_v3,
:instructeur_bypass_email_login_token, :instructeur_bypass_email_login_token,
:localization,
:maintenance_mode,
:make_experts_notifiable, :make_experts_notifiable,
:mini_profiler, :procedure_routage_api
:procedure_routage_api,
:xray
] ]
def database_exists? def database_exists?