ocean-rails 7.0.3 → 7.0.4

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
  SHA1:
3
- metadata.gz: 55ee0d2e59d628299a0b7c3d1b5736d20a2c7378
4
- data.tar.gz: 1954c7bbf968b5cfc53a66acb9763a840853107e
3
+ metadata.gz: c688e729d2c1b39ad3bdfa4784e9a2a592ac1fdb
4
+ data.tar.gz: 4b48fa1e6101bd8a33c88a56fc13adf941176aa5
5
5
  SHA512:
6
- metadata.gz: 78b5ccb8d16d7451f3499d475ed2171efbc13251e32f1b1b07dc226fd800aaf80842bfa77d4b0c57f742c2aa99fff167421a69e75c897a5c6ee9a50df77f1553
7
- data.tar.gz: 33ca5a629222de0b358e924caec26ffe26a3f179d982a2f43e3345c6e139ef75b94bfea6a826e37a8e0905af5562c1fcc7d7df897c699791238cdee864df4678
6
+ metadata.gz: 1be2f8a525ada27bd029d04e98c86e60571da22ce080008a7a228fcbee3313f711e69d33a5b3b1210df3738e14ecac1de0ae918ae431057882e9810001896d67
7
+ data.tar.gz: ab9b7ba1613a4617bb5e5336d51d5f2e21a95e27e102c4fc1069c9760cfb4ef91566013aaac51019c24e96842f6fbcde0047355dbaa7aa8e70fb6ae24857ae14
@@ -6,10 +6,12 @@ require "ocean/api_resource"
6
6
  require "ocean/ocean_resource_model" if defined? ActiveRecord || defined? OceanDynamo
7
7
  require "ocean/ocean_resource_controller" if defined? ActionController
8
8
  require "ocean/ocean_application_controller"
9
- require "ocean/zero_log"
10
- require "ocean/zeromq_logger"
11
- require "ocean/selective_rack_logger"
12
- require "ocean/flooding"
9
+ if ENV['RAILS_ENV'] == "production" && ENV['NO_ZEROMQ_LOGGING'].blank?
10
+ puts "YAAAAAAAS"
11
+ require "ocean/zero_log"
12
+ require "ocean/zeromq_logger"
13
+ require "ocean/selective_rack_logger"
14
+ end
13
15
  require "ocean/api_remote_resource"
14
16
 
15
17
  require "aws-sdk-v1" # Remove later
@@ -23,17 +25,19 @@ UUID_REGEX = /([0-9a-f]+-){4}[0-9a-f]+/
23
25
 
24
26
  module Ocean
25
27
 
26
- class Railtie < Rails::Railtie
27
- # Silence the /alive action
28
- initializer "ocean.swap_logging_middleware" do |app|
29
- app.middleware.swap Rails::Rack::Logger, SelectiveRackLogger
28
+ if ENV['RAILS_ENV'] == "production" && ENV['NO_ZEROMQ_LOGGING'].blank?
29
+ class Railtie < Rails::Railtie
30
+ # Silence the /alive action
31
+ initializer "ocean.swap_logging_middleware" do |app|
32
+ app.middleware.swap Rails::Rack::Logger, SelectiveRackLogger
33
+ end
34
+ # Make sure the generators use the gem's templates first
35
+ config.app_generators do |g|
36
+ g.templates.unshift File::expand_path('../templates', __FILE__)
37
+ end
30
38
  end
31
- # Make sure the generators use the gem's templates first
32
- config.app_generators do |g|
33
- g.templates.unshift File::expand_path('../templates', __FILE__)
34
- end
35
39
  end
36
-
40
+
37
41
  end
38
42
 
39
43
 
@@ -1,7 +1,6 @@
1
1
  #
2
2
  # This custom Rack middleware is used to turn off logging of requests made to
3
- # <code>/alive</code> by Varnish every 15 seconds in order to detect
4
- # failing instances for failover purposes.
3
+ # <code>/alive</code>.
5
4
  #
6
5
  class SelectiveRackLogger < Rails::Rack::Logger
7
6
 
@@ -1,3 +1,3 @@
1
1
  module Ocean
2
- VERSION = "7.0.3"
2
+ VERSION = "7.0.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ocean-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.0.3
4
+ version: 7.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Bengtson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-27 00:00:00.000000000 Z
11
+ date: 2017-04-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus
@@ -264,7 +264,6 @@ files:
264
264
  - lib/ocean/api_remote_resource.rb
265
265
  - lib/ocean/api_resource.rb
266
266
  - lib/ocean/engine.rb
267
- - lib/ocean/flooding.rb
268
267
  - lib/ocean/ocean_application_controller.rb
269
268
  - lib/ocean/ocean_resource_controller.rb
270
269
  - lib/ocean/ocean_resource_model.rb
@@ -1,29 +0,0 @@
1
- # # Rack::Attack.blacklist('block 1.2.3.4') do |req|
2
- # # true
3
- # # end
4
-
5
- # Rack::Attack.blacklisted_response = lambda do |env|
6
- # [ 403, {}, ['Blacklisted']]
7
- # end
8
-
9
-
10
- # Rack::Attack.throttle('req/ip', :limit => 1000, :period => 1.second) do |req|
11
- # # If the return value is truthy, the cache key for the return value
12
- # # is incremented and compared with the limit. In this case:
13
- # # "rack::attack:#{Time.now.to_i/1.second}:req/ip:#{req.ip}"
14
- # # We might want to use the token value instead of the #{req.ip} value.
15
- # # (IPs may be shared, tokens never are.)
16
- # #
17
- # # If falsy, the cache key is neither incremented nor checked.
18
- # req.ip
19
- # end
20
-
21
- # Rack::Attack.throttled_response = lambda do |env|
22
- # allowed = env['rack.attack.match_data'][:limit]
23
- # t = env['rack.attack.match_data'][:period].inspect
24
- # made = env['rack.attack.match_data'][:count]
25
- # retry_after = env['rack.attack.match_data'][:period] rescue nil
26
- # [ 429,
27
- # {'Retry-After' => retry_after.to_s},
28
- # ["Too Many Requests. You have exceeded your quota of #{allowed} request(s)/#{t} by #{made - allowed}."]]
29
- # end