0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-06 02:19:55 +08:00
discourse/config/initializers/100-verify_config.rb
Jarek Radosz 48691ee582
DEV: Enable Rails/FilePath rubocop rule (#40097)
(to be enabled in the shared config)
2026-05-19 19:07:54 +02:00

32 lines
1,017 B
Ruby
Vendored

# frozen_string_literal: true
# Check that the app is configured correctly. Raise some helpful errors if something is wrong.
if defined?(Rails::Server) && Rails.env.production? # Only run these checks when starting up a production server
if %w[localhost production.localhost].include?(Discourse.current_hostname)
puts <<~TEXT
Discourse.current_hostname = '#{Discourse.current_hostname}'
Please update the host_names property in config/database.yml
so that it uses the hostname of your site. Otherwise you will
experience problems, like links in emails using #{Discourse.current_hostname}.
TEXT
raise "Invalid host_names in database.yml"
end
if !Dir.glob(Rails.public_path.join("assets/application*.js").to_s).present?
puts <<~TEXT
Assets have not been precompiled. Please run the following command
before starting the rails server in production mode:
rake assets:precompile
TEXT
raise "Assets have not been precompiled"
end
end