herdst_worker 0.1.8 → 0.1.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0a1ae23a9aa07daa5d91b6d45638c6db57b506c9652f1faed6255dc0545d6dfe
4
- data.tar.gz: fc312df7ea263f0a72d1ef3bac0ee03bef0326f8f7b093105c5c0174a53204b6
3
+ metadata.gz: 6b6b9a0d96a5006442a1575169588704eadbadef89218f89962970f61e4a0172
4
+ data.tar.gz: 7f64060a9d13882974ce5a977a048371b8b00c898b9c0f1eae04c5e879e384ad
5
5
  SHA512:
6
- metadata.gz: c7312f0e0debcd8fe80d8cac228b032689ea826c4c43ffb9457c663a1fcc52e49063cf8d27006da5309a7ad0d71163745069e0761d6f482e97998acea85fe23d
7
- data.tar.gz: 48590ab2c15f342e70ded837c24997986cf8d2a0d965808325c1c38a7a2f59cd9ab2d4cdf358545f1dd42e7207070192157abe2d6bf6229056c164ff5d52d459
6
+ metadata.gz: ac149ff031d7504cb7584ad8535b3cf4f7d6727cc9c1a342268219b84aeba0db3e45c055491d1ba44d97fdce842878733266a94a2e9bd8da2961471c3a62867a
7
+ data.tar.gz: 7d2ee10d17bcfa82279b098da8de0bfc81a63dbc9fc13a82561fc1e70722b9e4666d80a1ec7bf3706df09139d9c7ee2ca5ba63b8f6327f151a0c3d201897cfef
@@ -4,25 +4,20 @@ module HerdstWorker
4
4
 
5
5
 
6
6
  def self.setup(app)
7
+ ActiveRecord::Base.default_timezone = :utc
8
+
7
9
  begin
8
- db_config = app.config_for(:database)
9
-
10
10
  if app.config.is_dev?
11
11
  ActiveRecord::Base.logger = app.logger.activerecord
12
12
  end
13
+
14
+ db_config = app.config_for(:database)
15
+ db_config.each do |k, v|
16
+ db_config[k] = ActiveRecord::DatabaseConfigurations::HashConfig.new(app.config.env, k, v)
17
+ end
13
18
 
14
- ActiveRecord::Base.default_timezone = :utc
15
- ActiveRecord::Base.establish_connection(
16
- adapter: db_config[:adapter],
17
- encoding: db_config[:encoding],
18
- charset: db_config[:charset],
19
- collation: db_config[:collation],
20
- pool: db_config[:pool],
21
- host: db_config[:host],
22
- username: db_config[:username],
23
- password: db_config[:password],
24
- database: db_config[:database]
25
- )
19
+ ActiveRecord::Base.configurations = db_config.values
20
+ ActiveRecord::Base.establish_connection(db_config[:primary])
26
21
  ActiveRecord::Base.connection.enable_query_cache!
27
22
  rescue Exception => ex
28
23
  app.logger.error ex.message
@@ -1,3 +1,3 @@
1
1
  module HerdstWorker
2
- VERSION = '0.1.8'
2
+ VERSION = '0.1.11'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: herdst_worker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Herd.St
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-04-04 00:00:00.000000000 Z
11
+ date: 2022-04-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport