From 201e23da3d4134348af6cb48a22cb984a60c6820 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Thu, 2 Jun 2022 17:03:10 +0200 Subject: [PATCH] Describe enabled processes in the consul.json URL The idea to show the status of the existing features was done in commit 7339a98b74. Back then, we didn't have the separate `process.` prefix, and so processes were enabled/disabled using settings like `feature.debates` instead of `process.debates`. IMHO making the information about the enabled features public could potentially be a bit risky since it gives too much information about the current status of the application. Showing which processes are enabled, on the other hand, is pretty harmless, and it's the reason why this feature was added in the first place. --- app/controllers/installation_controller.rb | 2 +- spec/controllers/installation_controller_spec.rb | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/controllers/installation_controller.rb b/app/controllers/installation_controller.rb index 419d257d7..bd25c90e3 100644 --- a/app/controllers/installation_controller.rb +++ b/app/controllers/installation_controller.rb @@ -14,6 +14,6 @@ class InstallationController < ApplicationController end def settings_feature_flags - Setting.where("key LIKE 'feature.%'").each_with_object({}) { |x, n| n[x.key.remove("feature.")] = x.value } + Setting.where("key LIKE 'process.%'").each_with_object({}) { |x, n| n[x.key.remove("process.")] = x.value } end end diff --git a/spec/controllers/installation_controller_spec.rb b/spec/controllers/installation_controller_spec.rb index 01b496a5d..d8cd40c3b 100644 --- a/spec/controllers/installation_controller_spec.rb +++ b/spec/controllers/installation_controller_spec.rb @@ -2,19 +2,19 @@ require "rails_helper" describe InstallationController, type: :request do describe "consul.json" do - let(:test_feature_settings) do + let(:test_process_settings) do { - "disabled_feature" => nil, - "enabled_feature" => "t" + "disabled_process" => nil, + "enabled_process" => "t" } end - let(:seeds_feature_settings) { Setting.where("key LIKE 'feature.%'") } + let(:seeds_process_settings) { Setting.where("key LIKE 'process.%'") } before do - seeds_feature_settings.destroy_all - test_feature_settings.each do |feature_name, feature_value| - Setting["feature.#{feature_name}"] = feature_value + seeds_process_settings.destroy_all + test_process_settings.each do |feature_name, feature_value| + Setting["process.#{feature_name}"] = feature_value end end @@ -23,7 +23,7 @@ describe InstallationController, type: :request do expect(response).to have_http_status(:ok) expect(JSON.parse(response.body)["release"]).not_to be_empty - expect(JSON.parse(response.body)["features"]).to eq(test_feature_settings) + expect(JSON.parse(response.body)["features"]).to eq(test_process_settings) end end end