mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 01:47:18 +02:00
Log REPP requests
This commit is contained in:
parent
0544dbd3ff
commit
568c52129f
8 changed files with 38 additions and 16 deletions
|
@ -4,11 +4,24 @@ module Repp
|
|||
prefix :repp
|
||||
|
||||
http_basic do |username, password|
|
||||
@current_user ||= EppUser.find_by(username: username, password: password)
|
||||
@current_api_user ||= EppUser.find_by(username: username, password: password)
|
||||
end
|
||||
|
||||
helpers do
|
||||
attr_reader :current_user
|
||||
attr_reader :current_api_user
|
||||
end
|
||||
|
||||
after do
|
||||
ApiLog::ReppLog.create({
|
||||
request_path: request.path,
|
||||
request_method: request.request_method,
|
||||
request_params: request.params.except('route_info').to_json,
|
||||
response: @response.to_json,
|
||||
response_code: status,
|
||||
api_user_name: current_api_user.try(:username),
|
||||
api_user_registrar: current_api_user.try(:registrar).try(:to_s),
|
||||
ip: request.ip
|
||||
})
|
||||
end
|
||||
|
||||
mount Repp::DomainV1
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue