roo_on_rails 2.2.0 → 2.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/roo_on_rails/tasks/db.rake +1 -2
- data/lib/roo_on_rails/version.rb +1 -1
- data/lib/roo_on_rails.rb +0 -1
- metadata +3 -4
- data/lib/roo_on_rails/railties/database.rb +0 -51
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 779360e44252a1b944aa8591e5a1996a7f461394fa8907ddf41428bb7212743d
|
4
|
+
data.tar.gz: f2a27f71b29dacf50739cabcdcd88cdfc89d37deeaf1bae8138a8ac929336c75
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bac595bc2dbcfcabfb479edbf0278399ce3911868b2da02b88051533503ee3891660d28c057e3a2f5301386990effdd5ce649630bc357a4d01db3796af1a1646
|
7
|
+
data.tar.gz: 220e8c0bb4b9d1734a8850bdb573adeade6c5f7782be7cf9ed09e7010222f0f2196519a2fc6831585a8bdfb88fd864b60af37aa3d02008e0cc5ca0c28750d788
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,7 @@ if defined?(ActiveRecord)
|
|
2
2
|
namespace :db do
|
3
3
|
desc 'Prints out the database statement timeout'
|
4
4
|
task statement_timeout: :environment do
|
5
|
+
ActiveRecord::Base.establish_connection
|
5
6
|
result = ActiveRecord::Base.connection.execute('SHOW statement_timeout').first
|
6
7
|
puts result['statement_timeout']
|
7
8
|
end
|
@@ -37,8 +38,6 @@ if defined?(ActiveRecord)
|
|
37
38
|
configs.delete(old_url_config)
|
38
39
|
configs << new_url_config
|
39
40
|
end
|
40
|
-
|
41
|
-
ActiveRecord::Base.establish_connection
|
42
41
|
end
|
43
42
|
end
|
44
43
|
end
|
data/lib/roo_on_rails/version.rb
CHANGED
data/lib/roo_on_rails.rb
CHANGED
@@ -6,7 +6,6 @@ end
|
|
6
6
|
if defined?(Rails)
|
7
7
|
require 'dotenv/rails-now'
|
8
8
|
require 'roo_on_rails/railties/env'
|
9
|
-
require 'roo_on_rails/railties/database'
|
10
9
|
require 'roo_on_rails/railties/http'
|
11
10
|
require 'roo_on_rails/railties/sidekiq_integration'
|
12
11
|
require 'roo_on_rails/railties/rake_tasks'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: roo_on_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Julien Letessier
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-10-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dotenv-rails
|
@@ -461,7 +461,6 @@ files:
|
|
461
461
|
- lib/roo_on_rails/papertrail_client.rb
|
462
462
|
- lib/roo_on_rails/rack/populate_env_from_jwt.rb
|
463
463
|
- lib/roo_on_rails/rack/safe_timeouts.rb
|
464
|
-
- lib/roo_on_rails/railties/database.rb
|
465
464
|
- lib/roo_on_rails/railties/env.rb
|
466
465
|
- lib/roo_on_rails/railties/google_oauth.rb
|
467
466
|
- lib/roo_on_rails/railties/http.rb
|
@@ -498,7 +497,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
498
497
|
- !ruby/object:Gem::Version
|
499
498
|
version: '0'
|
500
499
|
requirements: []
|
501
|
-
rubygems_version: 3.
|
500
|
+
rubygems_version: 3.0.9
|
502
501
|
signing_key:
|
503
502
|
specification_version: 4
|
504
503
|
summary: Scaffolding for building services
|
@@ -1,51 +0,0 @@
|
|
1
|
-
module RooOnRails
|
2
|
-
module Railties
|
3
|
-
class Database < Rails::Railtie
|
4
|
-
initializer 'roo_on_rails.database', after: 'active_record.initialize_database' do
|
5
|
-
ActiveSupport.on_load :active_record do
|
6
|
-
Rails.logger.debug('[roo_on_rails.database] loading')
|
7
|
-
|
8
|
-
if Gem::Version.new(Rails.version) >= Gem::Version.new('6.1')
|
9
|
-
configs = ActiveRecord::Base.configurations.configurations
|
10
|
-
old_url_config = ActiveRecord::Base.configurations.configs_for(env_name: Rails.env, name: 'primary')
|
11
|
-
new_config_hash = old_url_config.configuration_hash.deep_dup
|
12
|
-
new_config_hash[:variables] ||= {}
|
13
|
-
statement_timeout = ENV.fetch('DATABASE_STATEMENT_TIMEOUT', 200)
|
14
|
-
# Use -1 to disable setting the statement timeout
|
15
|
-
new_config_hash[:variables][:statement_timeout] = statement_timeout unless statement_timeout == '-1'
|
16
|
-
new_config_hash[:reaping_frequency] = ENV['DATABASE_REAPING_FREQUENCY'] if ENV.key?('DATABASE_REAPING_FREQUENCY')
|
17
|
-
if old_url_config.respond_to?(:url)
|
18
|
-
new_url_config = ActiveRecord::DatabaseConfigurations::UrlConfig.new(
|
19
|
-
old_url_config.env_name,
|
20
|
-
old_url_config.name,
|
21
|
-
old_url_config.url,
|
22
|
-
new_config_hash
|
23
|
-
)
|
24
|
-
else
|
25
|
-
new_url_config = ActiveRecord::DatabaseConfigurations::HashConfig.new(
|
26
|
-
old_url_config.env_name,
|
27
|
-
old_url_config.name,
|
28
|
-
new_config_hash
|
29
|
-
)
|
30
|
-
end
|
31
|
-
configs.delete(old_url_config)
|
32
|
-
configs << new_url_config
|
33
|
-
else
|
34
|
-
config = ActiveRecord::Base.configurations[Rails.env]
|
35
|
-
config['variables'] ||= {}
|
36
|
-
statement_timeout = ENV.fetch('DATABASE_STATEMENT_TIMEOUT', 200)
|
37
|
-
# Use -1 to disable setting the statement timeout
|
38
|
-
unless statement_timeout == '-1'
|
39
|
-
config['variables']['statement_timeout'] = statement_timeout
|
40
|
-
end
|
41
|
-
if ENV.key?('DATABASE_REAPING_FREQUENCY')
|
42
|
-
config['reaping_frequency'] = ENV['DATABASE_REAPING_FREQUENCY']
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
ActiveRecord::Base.establish_connection
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|