forked from discourse/discourse
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
38 changed files
with
84 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
MessageBus.site_id_lookup do | ||
RailsMultisite::ConnectionManagement.current_db | ||
end | ||
|
||
MessageBus.extra_response_headers_lookup do |env| | ||
{ | ||
"Access-Control-Allow-Origin" => Discourse.base_url_no_prefix, | ||
"Access-Control-Allow-Methods" => "GET, POST", | ||
"Access-Control-Allow-Headers" => "X-SILENCE-LOGGER, X-Shared-Session-Key" | ||
} | ||
end | ||
|
||
MessageBus.user_id_lookup do |env| | ||
user = CurrentUser.lookup_from_env(env) | ||
user.id if user | ||
end | ||
|
||
MessageBus.group_ids_lookup do |env| | ||
user = CurrentUser.lookup_from_env(env) | ||
if user && user.admin? | ||
# special rule, admin is allowed access to all groups | ||
Group.pluck(:id) | ||
elsif user | ||
user.groups.pluck('groups.id') | ||
end | ||
end | ||
|
||
MessageBus.on_connect do |site_id| | ||
RailsMultisite::ConnectionManagement.establish_connection(db: site_id) | ||
end | ||
|
||
MessageBus.on_disconnect do |site_id| | ||
ActiveRecord::Base.connection_handler.clear_active_connections! | ||
end | ||
|
||
# Point at our redis | ||
MessageBus.redis_config = GlobalSetting.redis_config | ||
|
||
MessageBus.long_polling_enabled = SiteSetting.enable_long_polling | ||
MessageBus.long_polling_interval = SiteSetting.long_polling_interval | ||
|
||
MessageBus.is_admin_lookup do |env| | ||
user = CurrentUser.lookup_from_env(env) | ||
if user && user.admin | ||
true | ||
else | ||
false | ||
end | ||
end | ||
|
||
MessageBus.cache_assets = !Rails.env.development? | ||
MessageBus.enable_diagnostics | ||
|
||
if Rails.env == "test" || $0 =~ /rake$/ | ||
# disable keepalive in testing | ||
MessageBus.keepalive_interval = -1 | ||
end |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# no reason to track this in development, that is 300+ redis calls saved per | ||
# page view (we serve all assets out of thin in development) | ||
if Rails.env != 'development' || ENV['TRACK_REQUESTS'] | ||
require 'middleware/request_tracker' | ||
Rails.configuration.middleware.unshift Middleware::RequestTracker | ||
end |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Be sure to restart your server when you modify this file. | ||
|
||
# Add new inflection rules using the following format | ||
# (all these examples are active by default): | ||
# ActiveSupport::Inflector.inflections do |inflect| | ||
# inflect.plural /^(ox)$/i, '\1en' | ||
# inflect.singular /^(ox)en/i, '\1' | ||
# inflect.irregular 'person', 'people' | ||
# inflect.uncountable %w( fish sheep ) | ||
# end |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Be sure to restart your server when you modify this file. | ||
|
||
# Add new mime types for use in respond_to blocks: | ||
# Mime::Type.register "text/richtext", :rtf | ||
# Mime::Type.register_alias "text/html", :iphone |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters