Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
wattsworth
/
lumen-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
4100c2b1
authored
Oct 09, 2018
by
John Doe
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
fixes for proxied interfaces and changed standalone e-mail
parent
deb1acc4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
4 deletions
app/controllers/interfaces_controller.rb
config/environments/development.rb
lib/tasks/local.rake
app/controllers/interfaces_controller.rb
View file @
4100c2b1
...
...
@@ -31,7 +31,7 @@ class InterfacesController < ActionController::Base
#everything else is proxied
def
get
path
=
request
.
fullpath
.
sub
(
"/api/interfaces/
#{
@joule_module
.
id
}
"
,
""
)
path
=
create_proxy_path
(
request
.
fullpath
,
@joule_module
.
id
)
proxied_response
=
@node_adapter
.
module_interface
(
@joule_module
,
path
)
render
plain:
proxied_response
.
body
...
...
@@ -44,7 +44,7 @@ class InterfacesController < ActionController::Base
end
def
post
path
=
request
.
fullpath
.
sub
(
"/api/interfaces/
#{
@joule_module
.
id
}
"
,
""
)
path
=
create_proxy_path
(
request
.
fullpath
,
@joule_module
.
id
)
proxied_response
=
@node_adapter
.
module_post_interface
(
@joule_module
,
path
)
render
plain:
proxied_response
.
body
...
...
@@ -94,4 +94,10 @@ class InterfacesController < ActionController::Base
render
'helpers/empty_response'
,
status: :unprocessable_entity
end
end
def
create_proxy_path
(
path
,
module_id
)
chunks
=
path
.
split
(
'/'
)
id_chunk
=
chunks
.
find_index
(
module_id
.
to_s
)
chunks
.
drop
(
id_chunk
+
1
).
join
(
'/'
)
end
end
config/environments/development.rb
View file @
4100c2b1
...
...
@@ -68,7 +68,7 @@ Rails.application.configure do
end
config
.
interface_url_template
=
lambda
do
|
id
|
#return "http://#{id}.interfaces.wattsworth.local"
return
"http://wattsworth.local/api/interfaces/
#{
id
}
"
return
"http://wattsworth.local/api/interfaces/
#{
id
}
/
"
end
end
lib/tasks/local.rake
View file @
4100c2b1
...
...
@@ -2,7 +2,7 @@ require 'factory_bot_rails'
ADMIN_NAME
=
"admin"
ADMIN_PASSWORD
=
"password"
ADMIN_EMAIL
=
"admin@wattsworth.local"
ADMIN_EMAIL
=
"admin@wattsworth.local
host
"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment