16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/generators/trek/install/config_generator.rb', line 16
def create_host_file
create_file "config/initializers/host.rb" do
" # Default protocol, host and canonical_url\n # Can be removed or refactored when this is merged:\n # https://github.com/rails/rails/issues/39566\n Rails.application.routes.default_url_options[:protocol] = Rails.application.config.force_ssl ? \"https\" : \"http\"\n Rails.application.routes.default_url_options[:host] = ENV.fetch(\"DEFAULT_HOSTNAME\", \"localhost:3000\")\n Rails.application.config.canonical_url = \"\\\#{Rails.application.routes.default_url_options[:protocol]}://\\\#{Rails.application.routes.default_url_options[:host]}\"\n\n # Mailers run outside a request, so in production they need the same host for\n # link helpers. Development and test keep the host from their environment files.\n # Deferred with on_load: referencing ActionMailer::Base here would load it\n # before the app's autoloader can resolve app classes, and its load hook\n # constantizes config.action_mailer.delivery_job \u2014 NameError at boot when\n # the app configures a custom delivery job.\n if Rails.env.production?\n ActiveSupport.on_load(:action_mailer) do\n self.default_url_options = Rails.application.routes.default_url_options\n end\n end\n RUBY\n end\nend\n"
|