From cac0fdb4906a7f23e664ea52879c4e2e35434641 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Wed, 5 Feb 2014 14:59:22 -0800 Subject: [PATCH] core: Add the default server URL --- lib/vagrant/shared_helpers.rb | 10 ++++++++-- test/unit/vagrant/shared_helpers_test.rb | 7 +++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/lib/vagrant/shared_helpers.rb b/lib/vagrant/shared_helpers.rb index 00c4a4bac..d1ab04053 100644 --- a/lib/vagrant/shared_helpers.rb +++ b/lib/vagrant/shared_helpers.rb @@ -1,6 +1,13 @@ require "pathname" module Vagrant + # This is the default endpoint of the Vagrant Cloud in + # use. API calls will be made to this for various functions + # of Vagrant that may require remote access. + # + # @return [String] + DEFAULT_SERVER_URL = "http://www.vagrantcloud.com" + # This returns whether or not 3rd party plugins should be loaded. # # @return [Boolean] @@ -12,8 +19,7 @@ module Vagrant # # @return [String] def self.server_url - # TODO: default - ENV["VAGRANT_SERVER_URL"] + ENV["VAGRANT_SERVER_URL"] || DEFAULT_SERVER_URL end # The source root is the path to the root directory of the Vagrant source. diff --git a/test/unit/vagrant/shared_helpers_test.rb b/test/unit/vagrant/shared_helpers_test.rb index b3561c9a9..cfa9cc46f 100644 --- a/test/unit/vagrant/shared_helpers_test.rb +++ b/test/unit/vagrant/shared_helpers_test.rb @@ -23,6 +23,13 @@ describe Vagrant do end describe "#server_url" do + it "defaults to the default value" do + with_temp_env("VAGRANT_SERVER_URL" => nil) do + expect(subject.server_url).to eq( + Vagrant::DEFAULT_SERVER_URL) + end + end + it "is the VAGRANT_SERVER_URL value" do with_temp_env("VAGRANT_SERVER_URL" => "foo") do expect(subject.server_url).to eq("foo")