Files
nairobi/app/controllers/installation_controller.rb
Javi Martín 201e23da3d 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.
2022-06-02 17:10:38 +02:00

20 lines
521 B
Ruby

class InstallationController < ApplicationController
skip_authorization_check
def details
respond_to do |format|
format.any { render json: consul_installation_details.to_json, content_type: "application/json" }
end
end
private
def consul_installation_details
{ release: "1.4.1" }.merge(features: settings_feature_flags)
end
def settings_feature_flags
Setting.where("key LIKE 'process.%'").each_with_object({}) { |x, n| n[x.key.remove("process.")] = x.value }
end
end