From 91a3dd9e6fe989e60a8aabf3df4243d59c6b828b Mon Sep 17 00:00:00 2001 From: Ashwin Maroli Date: Wed, 11 Nov 2020 18:29:44 +0530 Subject: [PATCH] Don't reset site.url to localhost:4000 by default (#7253) Merge pull request 7253 --- lib/jekyll/commands/serve.rb | 3 +++ test/test_commands_serve.rb | 6 ------ 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/lib/jekyll/commands/serve.rb b/lib/jekyll/commands/serve.rb index 7357b939..c3d0621a 100644 --- a/lib/jekyll/commands/serve.rb +++ b/lib/jekyll/commands/serve.rb @@ -249,6 +249,9 @@ module Jekyll def default_url(opts) config = configuration_from_options(opts) + auth = config.values_at("host", "port").join(":") + return config["url"] if auth == "127.0.0.1:4000" + format_url( config["ssl_cert"] && config["ssl_key"], config["host"] == "127.0.0.1" ? "localhost" : config["host"], diff --git a/test/test_commands_serve.rb b/test/test_commands_serve.rb index 455eb703..d9286a93 100644 --- a/test/test_commands_serve.rb +++ b/test/test_commands_serve.rb @@ -232,12 +232,6 @@ class TestCommandsServe < JekyllUnitTest expect(Jekyll).to receive(:env).and_return("development") expect(Jekyll::Commands::Serve).to receive(:start_up_webrick) end - should "set the site url by default to `http://localhost:4000`" do - @merc.execute(:serve, "watch" => false, "url" => "https://jekyllrb.com/") - - assert_equal 1, Jekyll.sites.count - assert_equal "http://localhost:4000", Jekyll.sites.first.config["url"] - end should "take `host`, `port` and `ssl` into consideration if set" do @merc.execute(:serve,