Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grape support #72

Merged
merged 5 commits into from
Apr 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions lib/newrelic_security/agent/utils/agent_utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,11 @@ def get_app_routes(framework)
ObjectSpace.each_object(::Grape::Endpoint) { |z|
z.routes.each { |route|
NewRelic::Security::Agent.agent.route_map << "#{route.options[:method]}@#{route.options[:namespace]}"
}
}
elsif framework == :padrino
ObjectSpace.each_object(::Padrino::PathRouter::Router) { |z|
z.instance_variable_get(:@routes).each { |route|
z.instance_variable_get(:@routes).each { |route|
NewRelic::Security::Agent.agent.route_map << "#{route.instance_variable_get(:@verb)}@#{route.instance_variable_get(:@path)}"
}
}
Expand Down Expand Up @@ -166,12 +168,12 @@ def app_port(env)

def app_root
#so far assuming it as Rails
#TBD, determing the frame work then use appropriate APIs
#val = Rails.root
#TBD, determing the frame work then use appropriate APIs
#val = Rails.root
root = nil
root = ::Rack::Directory.new(EMPTY_STRING).root.to_s if defined? ::Rack
root
end
end
end
end
end
Loading