From 3340a2b091318f0cdedd4a15a3cc25265099808e Mon Sep 17 00:00:00 2001 From: clemkeirua Date: Wed, 22 Jul 2020 09:05:13 +0200 Subject: [PATCH] ajout du nom d'application tot au demarrage The application name is used in the views, but also in the initializers and in the config/ directory According to rails doc (https://guides.rubyonrails.org/v6.0/configuring.html#locations-for-initialization-code), if we want to do some things before the initializers and the environment, the only place to do so is in config/application.rb --- config/application.rb | 1 + config/application_name.rb | 3 +++ config/env.example | 5 +++++ 3 files changed, 9 insertions(+) create mode 100644 config/application_name.rb diff --git a/config/application.rb b/config/application.rb index 82f67f903..3bc18619e 100644 --- a/config/application.rb +++ b/config/application.rb @@ -1,6 +1,7 @@ require File.expand_path('boot', __dir__) require 'rails/all' +require_relative 'application_name' # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. diff --git a/config/application_name.rb b/config/application_name.rb new file mode 100644 index 000000000..b8c7bf61d --- /dev/null +++ b/config/application_name.rb @@ -0,0 +1,3 @@ +APPLICATION_NAME = ENV.fetch("APPLICATION_NAME", "demarches-simplifiees.fr") +APPLICATION_SHORTNAME = ENV.fetch("APPLICATION_SHORTNAME", "d-s.fr") +APPLICATION_BASE_URL = ENV.fetch("APPLICATION_BASE_URL", "https://www.demarches-simplifiees.fr") diff --git a/config/env.example b/config/env.example index caefb947a..f8733f28e 100644 --- a/config/env.example +++ b/config/env.example @@ -10,6 +10,11 @@ APP_NAME="tps_local" # * pour de la prod: www.demarches-simplifiees.fr APP_HOST="localhost:3000" +# Les paramètres pour l'affichage du nom l'application, et pour la génération des liens +APPLICATION_NAME="demarches-simplifiees.fr" +APPLICATION_SHORTNAME="d-s.fr" +APPLICATION_BASE_URL="https://www.demarches-simplifiees.fr" + # Utilisé pour les logs LogRage SOURCE="tps_local"