Skip to content
This repository has been archived by the owner on Oct 12, 2018. It is now read-only.

Commit

Permalink
Correctly register publisher artefacts with router
Browse files Browse the repository at this point in the history
Publisher will set the owning_app to "publisher", and the rendering_app
to "frontend". This means that the router will route requests to
frontend.*.alphagov.co.uk rather than publisher.*.alphagov.co.uk
  • Loading branch information
jamiecobbett committed Jul 12, 2012
1 parent c2a1213 commit 6e31580
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/models/enhancements/artefact.rb
Expand Up @@ -3,5 +3,5 @@
class Artefact
# Add a non-field attribute so we can pass indexable content over to Rummager
# without persisting it
attr_accessor :indexable_content, :paths, :prefixes
attr_accessor :indexable_content, :paths, :prefixes, :rendering_app
end
13 changes: 9 additions & 4 deletions app/models/routable_artefact.rb
Expand Up @@ -15,8 +15,8 @@ def router
end

def ensure_application_exists
backend_url = Plek.current.find(@artefact.owning_app)
router.update_application(@artefact.owning_app, backend_url)
backend_url = Plek.current.find(rendering_app)
router.update_application(rendering_app, backend_url)
end

def submit
Expand All @@ -27,10 +27,15 @@ def submit
paths << @artefact.slug
end
paths.uniq.each do |path|
@router.create_route(path, "full", @artefact.owning_app)
@router.create_route(path, "full", rendering_app)
end
prefixes.each do |prefix|
@router.create_route(prefix, "prefix", @artefact.owning_app)
@router.create_route(prefix, "prefix", rendering_app)
end
end

private
def rendering_app
@artefact.rendering_app || @artefact.owning_app
end
end

0 comments on commit 6e31580

Please sign in to comment.