Commit 4100c2b1 by John Doe

fixes for proxied interfaces and changed standalone e-mail

parent deb1acc4
...@@ -31,7 +31,7 @@ class InterfacesController < ActionController::Base ...@@ -31,7 +31,7 @@ class InterfacesController < ActionController::Base
#everything else is proxied #everything else is proxied
def get 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) proxied_response = @node_adapter.module_interface(@joule_module,path)
render plain: proxied_response.body render plain: proxied_response.body
...@@ -44,7 +44,7 @@ class InterfacesController < ActionController::Base ...@@ -44,7 +44,7 @@ class InterfacesController < ActionController::Base
end end
def post 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) proxied_response = @node_adapter.module_post_interface(@joule_module,path)
render plain: proxied_response.body render plain: proxied_response.body
...@@ -94,4 +94,10 @@ class InterfacesController < ActionController::Base ...@@ -94,4 +94,10 @@ class InterfacesController < ActionController::Base
render 'helpers/empty_response', status: :unprocessable_entity render 'helpers/empty_response', status: :unprocessable_entity
end end
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 end
...@@ -68,7 +68,7 @@ Rails.application.configure do ...@@ -68,7 +68,7 @@ Rails.application.configure do
end end
config.interface_url_template = lambda do |id| config.interface_url_template = lambda do |id|
#return "http://#{id}.interfaces.wattsworth.local" #return "http://#{id}.interfaces.wattsworth.local"
return "http://wattsworth.local/api/interfaces/#{id}" return "http://wattsworth.local/api/interfaces/#{id}/"
end end
end end
...@@ -2,7 +2,7 @@ require 'factory_bot_rails' ...@@ -2,7 +2,7 @@ require 'factory_bot_rails'
ADMIN_NAME="admin" ADMIN_NAME="admin"
ADMIN_PASSWORD ="password" ADMIN_PASSWORD ="password"
ADMIN_EMAIL ="admin@wattsworth.local" ADMIN_EMAIL ="admin@wattsworth.localhost"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment