config: move application_name to an initializer

It seems cleaner not to require a file before the Rails configuration
runs.
This commit is contained in:
Pierre de La Morinerie 2021-02-24 14:06:33 +00:00
parent e920764078
commit fb305e31c4
3 changed files with 4 additions and 2 deletions

View file

@ -20,7 +20,7 @@ DS/Unscoped:
DS/ApplicationName:
Enabled: true
Exclude:
- './config/application_name.rb'
- './config/initializers/01_application_name.rb'
- './lib/cops/application_name.rb'
- './lib/linters/application_name_linter.rb'
- "./spec/**/*"

View file

@ -7,7 +7,6 @@ require 'rails/all'
Bundler.require(*Rails.groups)
Dotenv::Railtie.load
require_relative 'application_name'
module TPS
class Application < Rails::Application

View file

@ -1,3 +1,6 @@
# This file is named '01-application-name.rb' to load it before the other
# initializers, and thus make the APPLICATION_ constants available in
# the other initializers.
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")