restpack-web 0.2.22 → 0.2.23
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.
- data/lib/restpack-web/app.rb +15 -24
- data/lib/restpack-web/version.rb +1 -1
- metadata +1 -1
data/lib/restpack-web/app.rb
CHANGED
@@ -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
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
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
|
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
|
|
data/lib/restpack-web/version.rb
CHANGED