mirror of
https://github.com/codeninjasllc/discourse.git
synced 2025-02-25 16:04:22 -05:00
updated checks of environment with Rails.env by Rails.env methods
This commit is contained in:
parent
efb8dec951
commit
b4e38e5646
8 changed files with 11 additions and 11 deletions
|
@ -1,12 +1,12 @@
|
||||||
module CommonHelper
|
module CommonHelper
|
||||||
def render_google_universal_analytics_code
|
def render_google_universal_analytics_code
|
||||||
if Rails.env == "production" && SiteSetting.ga_universal_tracking_code.present?
|
if Rails.env.production? && SiteSetting.ga_universal_tracking_code.present?
|
||||||
render partial: "common/google_universal_analytics"
|
render partial: "common/google_universal_analytics"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def render_google_analytics_code
|
def render_google_analytics_code
|
||||||
if Rails.env == "production" && SiteSetting.ga_tracking_code.present?
|
if Rails.env.production? && SiteSetting.ga_tracking_code.present?
|
||||||
render partial: "common/google_analytics"
|
render partial: "common/google_analytics"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -23,7 +23,7 @@ module Jobs
|
||||||
Email::Sender.new(message, :new_version).send
|
Email::Sender.new(message, :new_version).send
|
||||||
end
|
end
|
||||||
rescue => e
|
rescue => e
|
||||||
raise e unless Rails.env == 'development' # Fail version check silently in development mode
|
raise e unless Rails.env.development? # Fail version check silently in development mode
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
true
|
true
|
||||||
|
|
|
@ -84,7 +84,7 @@ class AdminDashboardData
|
||||||
end
|
end
|
||||||
|
|
||||||
def rails_env_check
|
def rails_env_check
|
||||||
I18n.t("dashboard.rails_env_warning", env: Rails.env) unless Rails.env == 'production'
|
I18n.t("dashboard.rails_env_warning", env: Rails.env) unless Rails.env.production?
|
||||||
end
|
end
|
||||||
|
|
||||||
def host_names_check
|
def host_names_check
|
||||||
|
@ -170,7 +170,7 @@ class AdminDashboardData
|
||||||
end
|
end
|
||||||
|
|
||||||
def send_consumer_email_check
|
def send_consumer_email_check
|
||||||
I18n.t('dashboard.consumer_email_warning') if Rails.env == 'production' and ActionMailer::Base.smtp_settings[:address] =~ /gmail\.com|live\.com|yahoo\.com/
|
I18n.t('dashboard.consumer_email_warning') if Rails.env.production? and ActionMailer::Base.smtp_settings[:address] =~ /gmail\.com|live\.com|yahoo\.com/
|
||||||
end
|
end
|
||||||
|
|
||||||
def site_contact_username_check
|
def site_contact_username_check
|
||||||
|
|
|
@ -9,7 +9,7 @@ require_relative '../lib/discourse_plugin_registry'
|
||||||
# Global config
|
# Global config
|
||||||
require_relative '../app/models/global_setting'
|
require_relative '../app/models/global_setting'
|
||||||
|
|
||||||
require 'pry-rails' if Rails.env == "development"
|
require 'pry-rails' if Rails.env.development?
|
||||||
|
|
||||||
if defined?(Bundler)
|
if defined?(Bundler)
|
||||||
Bundler.require(*Rails.groups(assets: %w(development test profile)))
|
Bundler.require(*Rails.groups(assets: %w(development test profile)))
|
||||||
|
@ -18,7 +18,7 @@ end
|
||||||
module Discourse
|
module Discourse
|
||||||
class Application < Rails::Application
|
class Application < Rails::Application
|
||||||
def config.database_configuration
|
def config.database_configuration
|
||||||
if Rails.env == "production"
|
if Rails.env.production?
|
||||||
GlobalSetting.database_config
|
GlobalSetting.database_config
|
||||||
else
|
else
|
||||||
super
|
super
|
||||||
|
|
|
@ -14,7 +14,7 @@ Discourse::Application.routes.draw do
|
||||||
match "/404", to: "exceptions#not_found", via: [:get, :post]
|
match "/404", to: "exceptions#not_found", via: [:get, :post]
|
||||||
get "/404-body" => "exceptions#not_found_body"
|
get "/404-body" => "exceptions#not_found_body"
|
||||||
|
|
||||||
if Rails.env == "development"
|
if Rails.env.development?
|
||||||
mount Sidekiq::Web => "/sidekiq"
|
mount Sidekiq::Web => "/sidekiq"
|
||||||
mount Logster::Web => "/logs"
|
mount Logster::Web => "/logs"
|
||||||
else
|
else
|
||||||
|
|
|
@ -42,7 +42,7 @@ module DiscourseHub
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.hub_base_url
|
def self.hub_base_url
|
||||||
if Rails.env == 'production'
|
if Rails.env.production?
|
||||||
'http://api.discourse.org/api'
|
'http://api.discourse.org/api'
|
||||||
else
|
else
|
||||||
ENV['HUB_BASE_URL'] || 'http://local.hub:3000/api'
|
ENV['HUB_BASE_URL'] || 'http://local.hub:3000/api'
|
||||||
|
|
|
@ -58,7 +58,7 @@ module Import
|
||||||
rescue SystemExit
|
rescue SystemExit
|
||||||
log "Restore process was cancelled!"
|
log "Restore process was cancelled!"
|
||||||
rollback
|
rollback
|
||||||
rescue Exception => ex
|
rescue => ex
|
||||||
log "EXCEPTION: " + ex.message
|
log "EXCEPTION: " + ex.message
|
||||||
log ex.backtrace.join("\n")
|
log ex.backtrace.join("\n")
|
||||||
rollback
|
rollback
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
module Scheduler
|
module Scheduler
|
||||||
module Deferrable
|
module Deferrable
|
||||||
def initialize
|
def initialize
|
||||||
@async = Rails.env != "test"
|
@async = !Rails.env.test?
|
||||||
@queue = Queue.new
|
@queue = Queue.new
|
||||||
@mutex = Mutex.new
|
@mutex = Mutex.new
|
||||||
@thread = nil
|
@thread = nil
|
||||||
|
|
Loading…
Reference in a new issue