Commit 8528b63bce8f0f8b553a6df2422670cabfa98bef
Exists in
master
and in
1 other branch
Merge pull request #624 from humanpractice/configure_errbit_port
Allow errbit's own port to be configured
Showing
4 changed files
with
13 additions
and
1 deletions
Show diff stats
app/models/issue_tracker.rb
| ... | ... | @@ -4,6 +4,7 @@ class IssueTracker |
| 4 | 4 | include HashHelper |
| 5 | 5 | include Rails.application.routes.url_helpers |
| 6 | 6 | default_url_options[:host] = ActionMailer::Base.default_url_options[:host] |
| 7 | + default_url_options[:port] = ActionMailer::Base.default_url_options[:port] | |
| 7 | 8 | |
| 8 | 9 | embedded_in :app, :inverse_of => :issue_tracker |
| 9 | 10 | ... | ... |
app/models/notification_service.rb
| ... | ... | @@ -3,6 +3,7 @@ class NotificationService |
| 3 | 3 | |
| 4 | 4 | include Rails.application.routes.url_helpers |
| 5 | 5 | default_url_options[:host] = ActionMailer::Base.default_url_options[:host] |
| 6 | + default_url_options[:port] = ActionMailer::Base.default_url_options[:port] | |
| 6 | 7 | |
| 7 | 8 | field :room_id, :type => String |
| 8 | 9 | field :user_id, :type => String | ... | ... |
config/config.example.yml
| ... | ... | @@ -11,6 +11,10 @@ |
| 11 | 11 | # The host of your errbit server |
| 12 | 12 | host: errbit.example.com |
| 13 | 13 | |
| 14 | +# The port for your errbit server. | |
| 15 | +# Only set this if it isn't the default for the protocol (i.e.. 80 for HTTP, 443 for HTTPS) | |
| 16 | +# port: 8080 | |
| 17 | + | |
| 14 | 18 | # Enforce SSL connections |
| 15 | 19 | enforce_ssl: false |
| 16 | 20 | ... | ... |
config/initializers/_load_config.rb
| ... | ... | @@ -9,6 +9,7 @@ unless defined?(Errbit::Config) |
| 9 | 9 | # If Errbit is running on Heroku, config can be set from environment variables. |
| 10 | 10 | if use_env |
| 11 | 11 | Errbit::Config.host = ENV['ERRBIT_HOST'] |
| 12 | + Errbit::Config.port = ENV['ERRBIT_PORT'] | |
| 12 | 13 | Errbit::Config.email_from = ENV['ERRBIT_EMAIL_FROM'] |
| 13 | 14 | # Not really easy to use like an env because need an array and ENV return a string :( |
| 14 | 15 | # Errbit::Config.email_at_notices = ENV['ERRBIT_EMAIL_AT_NOTICES'] |
| ... | ... | @@ -78,7 +79,12 @@ end |
| 78 | 79 | |
| 79 | 80 | # Set config specific values |
| 80 | 81 | (ActionMailer::Base.default_url_options ||= {}).tap do |default| |
| 81 | - default.merge! :host => Errbit::Config.host if default[:host].blank? | |
| 82 | + options_from_config = { | |
| 83 | + host: Errbit::Config.host, | |
| 84 | + port: Errbit::Config.port | |
| 85 | + }.select { |k, v| v } | |
| 86 | + | |
| 87 | + default.reverse_merge!(options_from_config) | |
| 82 | 88 | end |
| 83 | 89 | |
| 84 | 90 | if Rails.env.production? | ... | ... |