diff --git a/config/application.rb b/config/application.rb index 1328ecd5bd4..3acc35c0dd2 100644 --- a/config/application.rb +++ b/config/application.rb @@ -88,7 +88,7 @@ def self.config DEFAULT_PAGINATION = 20 EMAIL_TOKEN_EXPIRES_AFTER = 3.hours HOST = config["host"].freeze - HOST_DISPLAY = Rails.env.production? || Rails.env.development? || Rails.env.test? ? "RubyGems.org" : "RubyGems.org #{Rails.env}" + HOST_DISPLAY = Gemcutter.config[:host_display].freeze NEWS_DAYS_LIMIT = 7.days NEWS_MAX_PAGES = 10 NEWS_PER_PAGE = 10 diff --git a/config/rubygems.yml b/config/rubygems.yml index 96a4b2217bf..4b1f7197af2 100644 --- a/config/rubygems.yml +++ b/config/rubygems.yml @@ -1,6 +1,7 @@ development: protocol: http host: localhost + host_display: RubyGems.org s3_bucket: s3bucket s3_contents_bucket: contents s3_compact_index_bucket: compact-index @@ -11,6 +12,7 @@ development: test: protocol: http host: localhost + host_display: RubyGems.org s3_bucket: test.s3.rubygems.org s3_contents_bucket: contents.test.s3.rubygems.org s3_compact_index_bucket: compact-index.test.s3.rubygems.org @@ -21,6 +23,7 @@ test: staging: protocol: https host: staging.rubygems.org + host_display: RubyGems.org Staging s3_bucket: oregon.staging.s3.rubygems.org s3_region: us-west-2 s3_endpoint: s3-us-west-2.amazonaws.com @@ -31,6 +34,7 @@ staging: production: protocol: https host: rubygems.org + host_display: RubyGems.org s3_bucket: oregon.production.s3.rubygems.org s3_region: us-west-2 s3_endpoint: s3-us-west-2.amazonaws.com @@ -38,13 +42,3 @@ production: s3_compact_index_bucket: compact-index.oregon.production.s3.rubygems.org versions_file_location: "./config/versions.list" separate_admin_host: rubygems.team - -oidc-api-token: - protocol: https - host: oidc-api-token.rubygems.org - s3_bucket: oregon.oidc-api-token.s3.rubygems.org - s3_region: us-west-2 - s3_endpoint: s3-us-west-2.amazonaws.com - s3_contents_bucket: contents.oregon.oidc-api-token.s3.rubygems.org - s3_compact_index_bucket: compact-index.oregon.oidc-api-token.s3.rubygems.org - versions_file_location: "./config/versions.list" diff --git a/test/config/gemcutter_config_test.rb b/test/config/gemcutter_config_test.rb new file mode 100644 index 00000000000..1b54b0de143 --- /dev/null +++ b/test/config/gemcutter_config_test.rb @@ -0,0 +1,28 @@ +require "test_helper" + +# These tests just spot check to make sure config is loaded correctly and the file is not broken or missing +class GemcutterConfigTest < ActiveSupport::TestCase + context "Gemcutter.config[:host_display]" do + should "be set for test environment" do + assert_equal "RubyGems.org", Gemcutter.config[:host_display] + end + + should "have a setting for each regularly used environment" do + assert_equal "RubyGems.org", Gemcutter::Application.config_for(:rubygems, env: "development").fetch(:host_display) + assert_equal "RubyGems.org", Gemcutter::Application.config_for(:rubygems, env: "production").fetch(:host_display) + assert_equal "RubyGems.org Staging", Gemcutter::Application.config_for(:rubygems, env: "staging").fetch(:host_display) + end + end + + context "Gemcutter.config[:host]" do + should "be set for test environment" do + assert_equal "localhost", Gemcutter.config[:host] + end + + should "have a setting for each regularly used environment" do + assert_equal "localhost", Gemcutter::Application.config_for(:rubygems, env: "development").fetch(:host) + assert_equal "rubygems.org", Gemcutter::Application.config_for(:rubygems, env: "production").fetch(:host) + assert_equal "staging.rubygems.org", Gemcutter::Application.config_for(:rubygems, env: "staging").fetch(:host) + end + end +end