perus 0.1.33 → 0.1.34

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1039bf1d4986cc417fd60adc6ab7a80acc7ccf00
4
- data.tar.gz: b68bed313db749d66341f87a8c7b00410e31695b
3
+ metadata.gz: c02ac4e4ffbf39beae5bfbf6dbe3c0539e10dc3f
4
+ data.tar.gz: 10247b2d8bf3123aab420b7bdb649d433fc9bbc0
5
5
  SHA512:
6
- metadata.gz: 72d1dfd9593f9410778bb04eeb4d08e4c73a20a3a52ebc21cf631eb5f74cc411259357c81433c70586a8499a0146da36a10ac5d88a5af74b620123c2e39e072d
7
- data.tar.gz: 8b4c711888594c5439bdfa692e3cefcec07dc9f641cdea0c1d356ca1b49fa9d6d9eab0f1aa96114c61624afda92c8e30077d040608d2363ecfd0d9d24c5b29eb
6
+ metadata.gz: 11e5dde4ad6f3c77bf1601a46ce820792282aeba52c3e672c2b50832cbdd11318b6503f7a8550b4fd652f43551f29a3544c3637a506c45ffc5ae3c5f667440be
7
+ data.tar.gz: 33c76fca67735b5643cc4521c5c2a8100900bdc21cf4942adf80b3a2a52732aa0ec4282b5ab469267abe42191b0ef317cd2f6588be19d249f61e83b63735ccb0
@@ -157,11 +157,7 @@ module Perus::Server
157
157
  timestamp = Time.now.to_i
158
158
  ping_params = params.dup
159
159
 
160
- if request.ip == '127.0.0.1' && ENV['RACK_ENV'] == 'production'
161
- system_ip = request.env['HTTP_X_FORWARDED_FOR']
162
- else
163
- system_ip = request.ip
164
- end
160
+ system_ip = request.env['HTTP_X_FORWARDED_FOR'] || request.ip
165
161
 
166
162
  Server.ping_queue << Proc.new do
167
163
  # update the system with its last known ip and update time
@@ -193,19 +189,13 @@ module Perus::Server
193
189
 
194
190
  # config of system based on request ip
195
191
  get '/systems/config_for_ip' do
196
- ip = nil
192
+ ip = request.env['HTTP_X_FORWARDED_FOR'] || request.ip
197
193
  begin
198
- if request.ip == '127.0.0.1' && ENV['RACK_ENV'] == 'production'
199
- ip = request.env['HTTP_X_FORWARDED_FOR']
200
- else
201
- ip = request.ip
202
- end
203
-
204
194
  system = System.where(ip: ip).first
205
195
  content_type :json
206
196
  system.config_hash.to_json
207
197
  rescue => e
208
- puts "\nNo config for: #{ip}\n"
198
+ STDERR.puts "\nNo config for: #{ip}\n"
209
199
  raise e
210
200
  end
211
201
  end
data/lib/perus/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Perus
2
- VERSION = "0.1.33"
2
+ VERSION = "0.1.34"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: perus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.33
4
+ version: 0.1.34
5
5
  platform: ruby
6
6
  authors:
7
7
  - Will Cannings