Skip to content

Commit

Permalink
DEV: Compatibility with Discourse on Rails 6.1 (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
OsamaSayegh committed Apr 21, 2021
1 parent b3f511e commit 0d47e63
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions .discourse-compatibility
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.7.0.beta6: b3f511e1d2bcb7cedb0bf6c582efbda0a5488bd3
2 changes: 1 addition & 1 deletion lib/internal_metric/global.rb
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def primary_site_readonly?
end

def test_postgres(master: true)
config = ActiveRecord::Base.connection_config
config = ActiveRecord::Base.connection_db_config.configuration_hash

unless master
if config[:replica_host]
Expand Down
4 changes: 3 additions & 1 deletion spec/lib/internal_metric/global_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,14 @@ module DiscoursePrometheus::InternalMetric

describe 'when a replica has been configured' do
before do
config = ActiveRecord::Base.connection_config
config = ActiveRecord::Base.connection_db_config.configuration_hash.dup

config.merge!(
replica_host: 'localhost',
replica_port: 1111
)
ActiveRecord::Base.connection.disconnect!
ActiveRecord::Base.establish_connection(config)
end

it 'should collect the right metrics' do
Expand Down

0 comments on commit 0d47e63

Please sign in to comment.