From b7e116b53fec332f291e37ecc0cb121ad5c814ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Thu, 29 Sep 2022 02:43:31 +0200 Subject: [PATCH] Allow adding per-environment custom settings Until now, when editing a specific environment, other CONSUL installations had to edit the original file, which made it harder to upgrade. Now it's possible to change the default CONSUL settings using custom files, making it easier to upgrade to versions of CONSUL which change the original environment files (which is very common when upgrading versions of Rails). --- config/environments/custom/development.rb | 4 ++++ config/environments/custom/preproduction.rb | 4 ++++ config/environments/custom/production.rb | 4 ++++ config/environments/custom/staging.rb | 7 +++++++ config/environments/custom/test.rb | 4 ++++ config/environments/development.rb | 2 ++ config/environments/preproduction.rb | 1 + config/environments/production.rb | 2 ++ config/environments/staging.rb | 2 ++ config/environments/test.rb | 2 ++ 10 files changed, 32 insertions(+) create mode 100644 config/environments/custom/development.rb create mode 100644 config/environments/custom/preproduction.rb create mode 100644 config/environments/custom/production.rb create mode 100644 config/environments/custom/staging.rb create mode 100644 config/environments/custom/test.rb diff --git a/config/environments/custom/development.rb b/config/environments/custom/development.rb new file mode 100644 index 000000000..ef56c3d4a --- /dev/null +++ b/config/environments/custom/development.rb @@ -0,0 +1,4 @@ +Rails.application.configure do + # Overwrite settings for the development environment or add your own + # custom settings for this environment. +end diff --git a/config/environments/custom/preproduction.rb b/config/environments/custom/preproduction.rb new file mode 100644 index 000000000..0ba7acfba --- /dev/null +++ b/config/environments/custom/preproduction.rb @@ -0,0 +1,4 @@ +Rails.application.configure do + # Overwrite settings for the preproduction environment or add your own + # custom settings for this environment. +end diff --git a/config/environments/custom/production.rb b/config/environments/custom/production.rb new file mode 100644 index 000000000..ffdddca82 --- /dev/null +++ b/config/environments/custom/production.rb @@ -0,0 +1,4 @@ +Rails.application.configure do + # Overwrite settings for the production environment or add your own + # custom settings for this environment. +end diff --git a/config/environments/custom/staging.rb b/config/environments/custom/staging.rb new file mode 100644 index 000000000..6f9e80d77 --- /dev/null +++ b/config/environments/custom/staging.rb @@ -0,0 +1,7 @@ +Rails.application.configure do + # Overwrite settings for the staging environment or add your own + # custom settings for this environment. Note these changes will + # also affect the preproduction environment, so edit the + # `config/environments/custom/preproduction.rb` file if you don't + # want these changes to be applied there as well. +end diff --git a/config/environments/custom/test.rb b/config/environments/custom/test.rb new file mode 100644 index 000000000..6fa5e8636 --- /dev/null +++ b/config/environments/custom/test.rb @@ -0,0 +1,4 @@ +Rails.application.configure do + # Overwrite settings for the test environment or add your own + # custom settings for this environment. +end diff --git a/config/environments/development.rb b/config/environments/development.rb index 72d7ec69b..3a2780781 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -71,3 +71,5 @@ Rails.application.configure do # routes, locales, etc. This feature depends on the listen gem. # config.file_watcher = ActiveSupport::EventedFileUpdateChecker end + +require Rails.root.join("config", "environments", "custom", "development") diff --git a/config/environments/preproduction.rb b/config/environments/preproduction.rb index dc25ea047..0458782a9 100644 --- a/config/environments/preproduction.rb +++ b/config/environments/preproduction.rb @@ -1 +1,2 @@ require Rails.root.join("config", "environments", "staging") +require Rails.root.join("config", "environments", "custom", "preproduction") diff --git a/config/environments/production.rb b/config/environments/production.rb index 9c8f2e683..5c61e471a 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -122,3 +122,5 @@ Rails.application.configure do # config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver # config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session end + +require Rails.root.join("config", "environments", "custom", "production") diff --git a/config/environments/staging.rb b/config/environments/staging.rb index f05d0a6ee..7b3c2ae66 100644 --- a/config/environments/staging.rb +++ b/config/environments/staging.rb @@ -121,3 +121,5 @@ Rails.application.configure do # config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver # config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session end + +require Rails.root.join("config", "environments", "custom", "staging") diff --git a/config/environments/test.rb b/config/environments/test.rb index 463b25f08..fb5deebb8 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -61,3 +61,5 @@ Rails.application.configure do end end end + +require Rails.root.join("config", "environments", "custom", "test")