Skip to content

Commit

Permalink
Update database connection config (Need to move to a parser)
Browse files Browse the repository at this point in the history
  • Loading branch information
lloydwatkin committed Apr 9, 2024
1 parent 1c423cd commit d16101f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
janus-ar (0.1.0)
janus-ar (0.3.0)

GEM
remote: http://rubygems.org/
Expand Down
8 changes: 3 additions & 5 deletions lib/active_record/connection_adapters/janus_mysql2_adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,12 @@ class JanusMysql2Adapter < ActiveRecord::ConnectionAdapters::Mysql2Adapter
SQL_SKIP_ALL_MATCHERS = [/\A\s*set\s+local\s/i].freeze

def initialize(*args)
args[0][:janus]['replica']['database'] = args[0][:database]
args[0][:janus]['primary']['database'] = args[0][:database]

@replica_config = args[0][:janus]['replica']
args[0] = args[0][:janus]['primary']

if args[0]['database'].nil?
args[0]['database'] = nil
@replica_config['database'] = nil
end

super(*args)
@connection_parameters ||= args[0]
update_config
Expand Down
2 changes: 1 addition & 1 deletion lib/janus/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Janus
unless defined?(::Janus::VERSION)
module VERSION
MAJOR = 0
MINOR = 3
MINOR = 4
PATCH = 0
PRE = nil

Expand Down

0 comments on commit d16101f

Please sign in to comment.