core: Add the default server URL
This commit is contained in:
parent
eab1d1150a
commit
cac0fdb490
|
@ -1,6 +1,13 @@
|
||||||
require "pathname"
|
require "pathname"
|
||||||
|
|
||||||
module Vagrant
|
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.
|
# This returns whether or not 3rd party plugins should be loaded.
|
||||||
#
|
#
|
||||||
# @return [Boolean]
|
# @return [Boolean]
|
||||||
|
@ -12,8 +19,7 @@ module Vagrant
|
||||||
#
|
#
|
||||||
# @return [String]
|
# @return [String]
|
||||||
def self.server_url
|
def self.server_url
|
||||||
# TODO: default
|
ENV["VAGRANT_SERVER_URL"] || DEFAULT_SERVER_URL
|
||||||
ENV["VAGRANT_SERVER_URL"]
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# The source root is the path to the root directory of the Vagrant source.
|
# The source root is the path to the root directory of the Vagrant source.
|
||||||
|
|
|
@ -23,6 +23,13 @@ describe Vagrant do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "#server_url" do
|
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
|
it "is the VAGRANT_SERVER_URL value" do
|
||||||
with_temp_env("VAGRANT_SERVER_URL" => "foo") do
|
with_temp_env("VAGRANT_SERVER_URL" => "foo") do
|
||||||
expect(subject.server_url).to eq("foo")
|
expect(subject.server_url).to eq("foo")
|
||||||
|
|
Loading…
Reference in New Issue