restpack-web 0.1.19 → 0.1.20
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/restpack-web/app.rb +31 -29
- data/lib/restpack-web/version.rb +1 -1
- metadata +1 -1
data/lib/restpack-web/app.rb
CHANGED
@@ -16,8 +16,6 @@ module RestPack
|
|
16
16
|
def call(env)
|
17
17
|
env[:restpack] ||= {}
|
18
18
|
begin #TODO: GJ: cache should handle errors gracefully
|
19
|
-
|
20
|
-
|
21
19
|
host = env["SERVER_NAME"]
|
22
20
|
env[:restpack][:host] = host
|
23
21
|
|
@@ -41,38 +39,42 @@ module RestPack
|
|
41
39
|
|
42
40
|
@app.call(env)
|
43
41
|
end
|
44
|
-
end
|
45
|
-
|
46
|
-
protected
|
47
|
-
|
48
|
-
def add_user(env)
|
49
|
-
user_id = env['rack.session'][:user_id]
|
50
|
-
if user_id
|
51
|
-
url = "http://:1234@localhost:1112/api/v1/users/#{user_id}.json" #TODO: GJ: build from config
|
52
|
-
p url
|
53
|
-
json = RestClient.get(url)
|
54
|
-
user = JSON.parse(json)['user']
|
55
|
-
env[:restpack][:user] = user
|
56
|
-
end
|
57
42
|
|
58
|
-
|
59
|
-
end
|
60
|
-
|
61
|
-
def add_application_domains(env)
|
62
|
-
application = env[:restpack][:application]
|
63
|
-
|
64
|
-
domains = {}
|
43
|
+
private
|
65
44
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
45
|
+
def add_user(env)
|
46
|
+
user_id = env['rack.session'][:user_id]
|
47
|
+
if user_id
|
48
|
+
url = "http://:1234@localhost:1112/api/v1/users/#{user_id}.json" #TODO: GJ: build from config
|
49
|
+
p url
|
50
|
+
json = RestClient.get(url)
|
51
|
+
user = JSON.parse(json)['user']
|
52
|
+
env[:restpack][:user] = user
|
71
53
|
end
|
54
|
+
|
55
|
+
env[:restpack][:user_id] = user_id
|
56
|
+
end
|
57
|
+
|
58
|
+
def add_application_domains(env)
|
59
|
+
application = env[:restpack][:application]
|
60
|
+
|
61
|
+
domains = {}
|
62
|
+
|
63
|
+
configured_domains = application.get_configuration_by_key('domains')
|
64
|
+
|
65
|
+
if configured_domains
|
66
|
+
for key in configured_domains.value.keys
|
67
|
+
domains[key] = configured_domains.value[key]
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
env[:restpack][:application_domains] = domains
|
72
72
|
end
|
73
|
-
|
74
|
-
env[:restpack][:application_domains] = domains
|
75
73
|
end
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
76
78
|
|
77
79
|
end
|
78
80
|
end
|
data/lib/restpack-web/version.rb
CHANGED