mirror of
https://github.com/discourse/discourse.git
synced 2024-11-29 20:24:05 -06:00
7970d1d99f
The cluster name can be configured by setting the `DISCOURSE_CLUSTER_NAME` environment variable. If set, you can then call /srv/status with a `?cluster=` parameter. If the cluster does not match, an error will be returned. This is useful if you need a load balancer to be able to verify the identity, as well as the presence, of an application container.
28 lines
693 B
Ruby
28 lines
693 B
Ruby
# frozen_string_literal: true
|
|
|
|
require "read_only_header"
|
|
|
|
class ForumsController < ActionController::Base
|
|
include ReadOnlyHeader
|
|
|
|
before_action :check_readonly_mode
|
|
after_action :add_readonly_header
|
|
|
|
def status
|
|
if params[:cluster]
|
|
if GlobalSetting.cluster_name.nil?
|
|
return render plain: "cluster name not configured", status: 500
|
|
elsif GlobalSetting.cluster_name != params[:cluster]
|
|
return render plain: "cluster name does not match", status: 500
|
|
end
|
|
end
|
|
|
|
if $shutdown # rubocop:disable Style/GlobalVars
|
|
render plain: "shutting down", status: (params[:shutdown_ok] ? 200 : 500)
|
|
else
|
|
render plain: "ok"
|
|
end
|
|
end
|
|
|
|
end
|