Commit b331b7bc authored by Gabriel Mazetto's avatar Gabriel Mazetto

endpoint in geo to receive system hook events from primary node

parent c90f6d22
...@@ -31,6 +31,20 @@ module API ...@@ -31,6 +31,20 @@ module API
required_attributes! %w(event_name key id) required_attributes! %w(event_name key id)
::Geo::ScheduleKeyChangeService.new(params).execute ::Geo::ScheduleKeyChangeService.new(params).execute
end end
# Receive event streams from primary and enqueue changes
#
# Example request:
# POST /geo/receive_events
post 'receive_events' do
required_attributes! %w(event_name)
case params['event_name']
when 'key_create', 'key_destroy'
required_attributes! %w(key id)
::Geo::ScheduleKeyChangeService.new(params).execute
end
end
end end
end end
end end
...@@ -2,7 +2,7 @@ module Gitlab ...@@ -2,7 +2,7 @@ module Gitlab
module Middleware module Middleware
class ReadonlyGeo class ReadonlyGeo
DISALLOWED_METHODS = %w(POST PATCH PUT DELETE) DISALLOWED_METHODS = %w(POST PATCH PUT DELETE)
WHITELISTED = %w(api/v3/internal api/v3/geo/refresh_projects api/v3/geo/refresh_wikis api/v3/geo/refresh_key) WHITELISTED = %w(api/v3/internal api/v3/geo/refresh_projects api/v3/geo/refresh_wikis api/v3/geo/refresh_key api/v3/geo/receive_events)
APPLICATION_JSON = 'application/json' APPLICATION_JSON = 'application/json'
def initialize(app) def initialize(app)
......
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 to comment