restpack-web 0.2.22 → 0.2.23

Sign up to get free protection for your applications and to get access to all the features.
@@ -9,6 +9,7 @@ module RestPack
9
9
 
10
10
  options[:core_domain] ||= ENV['RESTPACK_CORE_SERVICE']
11
11
  options[:access_key] ||= ENV['RESTPACK_ACCESS_KEY']
12
+ @options = options
12
13
 
13
14
  unless options[:core_domain] || options[:access_key]
14
15
  p "[WARNING] Missing RestPack configuration"
@@ -21,28 +22,19 @@ module RestPack
21
22
  env[:restpack] ||= {}
22
23
 
23
24
  #TODO: GJ: ignore requests with a file extension
24
- begin #TODO: GJ: cache should handle errors gracefully
25
- request = Rack::Request.new(env)
26
- channel = @core_cache.get_channel(request.host)
27
- domain = channel.get_domain_by_host(request.host)
28
-
29
- env[:restpack][:request] = request
30
- env[:restpack][:host] = request.host
31
- env[:restpack][:channel] = channel
32
- env[:restpack][:application] = domain.application
33
- env[:restpack][:domain] = domain
34
- env[:restpack][:configurations] = @core_cache.configurations
35
- env[:restpack][:services] = @core_cache.get_configuration_value('services', [])
36
-
37
- add_user env
38
-
39
- rescue Exception => e
40
- p "---"
41
- p e.message
42
- p "===="
43
- p e.backtrace.inspect
44
- p "---"
45
- end
25
+ request = Rack::Request.new(env)
26
+ channel = @core_cache.get_channel(request.host)
27
+ domain = channel.get_domain_by_host(request.host)
28
+
29
+ env[:restpack][:request] = request
30
+ env[:restpack][:host] = request.host
31
+ env[:restpack][:channel] = channel
32
+ env[:restpack][:application] = domain.application
33
+ env[:restpack][:domain] = domain
34
+ env[:restpack][:configurations] = @core_cache.configurations
35
+ env[:restpack][:services] = @core_cache.get_configuration_value('services', [])
36
+
37
+ add_user env
46
38
 
47
39
  @app.call(env)
48
40
  end
@@ -53,8 +45,7 @@ module RestPack
53
45
  user_id = env['rack.session'][:user_id]
54
46
 
55
47
  if user_id
56
- url = "http://:1234@localhost:1112/api/v1/users/#{user_id}.json" #TODO: GJ: build from config
57
- p url
48
+ url = "http://:#{@options[:access_key]}@#{ENV['RESTPACK_USER_SERVICE']}/api/v1/users/#{user_id}.json" #TODO: GJ: build from config
58
49
  json = RestClient.get(url)
59
50
  user = Yajl::Parser.parse(json, :symbolize_keys => true)[:user]
60
51
 
@@ -1,5 +1,5 @@
1
1
  module RestPack
2
2
  module Web
3
- VERSION = "0.2.22"
3
+ VERSION = "0.2.23"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: restpack-web
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.22
4
+ version: 0.2.23
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: