mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-04-29 13:28:22 +08:00
This commit adds DISCOURSE_LOCAL_EMAIL_PORT environment variable to allow setting a port other than 1025 for local mail. This is added because now macOS has a system service using port 1025, causing conflicts when running a local mail server for Discourse development.
14 lines
583 B
Ruby
14 lines
583 B
Ruby
# frozen_string_literal: true
|
|
|
|
# Load the Rails application.
|
|
require_relative "application"
|
|
|
|
# Initialize the Rails application.
|
|
Rails.application.initialize!
|
|
|
|
# When in "dev" mode, ensure we won't be sending any emails
|
|
if Rails.env.development? && !GlobalSetting.try(:use_smtp_environment_in_development) &&
|
|
ActionMailer::Base.smtp_settings.slice(:address, :port) !=
|
|
{ address: "localhost", port: ENV["DISCOURSE_LOCAL_EMAIL_PORT"] || 1025 }
|
|
fail "In development mode, you should be using a local development mail server to avoid unintentionally sending real mail"
|
|
end
|