herdst_worker 0.1.8 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/herdst_worker/adapters/database.rb +6 -12
- data/lib/herdst_worker/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e394fc18334aecfcbb21d5c9e639067a1f777b2d137edd9fb404bc6c86722613
|
4
|
+
data.tar.gz: ed79d59376596ec7f57d753d9c87f5ed939362834fdbde91a84392857f304a65
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8e4f9442a39b0d8b0e14ce93c14963ce7ca9297e054a9df5d66e0a1e335de543731ccef5b8fd41939efa74907ca7c1167bb3b60ed65404d7c6f497da84ca7739
|
7
|
+
data.tar.gz: 49e2e8e2e01b3fcebf58b48f253cf763f59b18013b560aabe80f719ed2f52b0594494f9809e2e3c0bb3429ba71644622b9c04632cd90fc4118a55219bffaace5
|
@@ -6,23 +6,17 @@ module HerdstWorker
|
|
6
6
|
def self.setup(app)
|
7
7
|
begin
|
8
8
|
db_config = app.config_for(:database)
|
9
|
-
|
9
|
+
db_config.each do |k, v|
|
10
|
+
db_config[k] = ActiveRecord::DatabaseConfigurations::HashConfig.new(app.config.env, k, v)
|
11
|
+
end
|
12
|
+
|
10
13
|
if app.config.is_dev?
|
11
14
|
ActiveRecord::Base.logger = app.logger.activerecord
|
12
15
|
end
|
13
16
|
|
17
|
+
ActiveRecord::Base.configurations = db_config.values
|
14
18
|
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.establish_connection(db_config[:primary])
|
26
20
|
ActiveRecord::Base.connection.enable_query_cache!
|
27
21
|
rescue Exception => ex
|
28
22
|
app.logger.error ex.message
|
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.
|
4
|
+
version: 0.1.9
|
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-
|
11
|
+
date: 2022-04-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|