Skip to content

Commit

Permalink
Always register api.domain with the router
Browse files Browse the repository at this point in the history
* api.domain will always reach the cloud controller.
* Any existing prefixes will also be registered so they will work too.
* Manifests that use ccng will continue to work with both ccng.domain and
api.domain with no changes.
  • Loading branch information
Kai Xiang and Matthew Boedicker committed Mar 19, 2013
1 parent e17caef commit eda9b34
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
Expand Up @@ -40,7 +40,7 @@ def read_serialized_url(gateway_name, snapshot_id)

def get_upload_url(gateway_name)
#TODO: switch upload url returns to point to sds
"#{@config[:external_domain]}/services/v1/configurations/#{gateway_name}/serialized/data"
"#{[*@config[:external_domain]].first}/services/v1/configurations/#{gateway_name}/serialized/data"
end

def import_from_url(gateway_name)
Expand Down
2 changes: 1 addition & 1 deletion lib/cloud_controller/message_bus.rb
Expand Up @@ -44,7 +44,7 @@ def register_routes
router_register_message = Yajl::Encoder.encode({
:host => @config[:bind_address],
:port => config[:port],
:uris => [config[:external_domain]],
:uris => config[:external_domain],
:tags => {:component => "CloudController" },
})

Expand Down
7 changes: 7 additions & 0 deletions spec/api/legacy_service_lifecycle_spec.rb
Expand Up @@ -438,6 +438,13 @@ module VCAP::CloudController
post "/services/v1/configurations/lifecycle/serialized/uploads", {}, headers_for(@user)
last_response.status.should == 200
last_response.body.should == "http://api.fake.com/services/v1/configurations/lifecycle/serialized/data"
end

it "should create a upload url" do
config_override(:external_domain => %w{http://api.fake.com http://api.fake2.com/})
post "/services/v1/configurations/lifecycle/serialized/uploads", {}, headers_for(@user)
last_response.status.should == 200
last_response.body.should == "http://api.fake.com/services/v1/configurations/lifecycle/serialized/data"
end
end

Expand Down

0 comments on commit eda9b34

Please sign in to comment.