Skip to content

A platform for community discussion. Free, open, simple.

DEV: Allow new_features URL to be configurable (#24306)

Martin Brennane772bb9fce60
diff --git a/lib/discourse_updates.rb b/lib/discourse_updates.rb
index d20870b9668..6af0ee5ceb8 100644
--- a/lib/discourse_updates.rb
+++ b/lib/discourse_updates.rb
@@ -218,6 +218,11 @@ module DiscourseUpdates
)
end
+ def new_features_endpoint
+ return "https://meta.discourse.org/new-features.json" if Rails.env.production?
+ ENV["DISCOURSE_NEW_FEATURES_ENDPOINT"] || "http://localhost:4200/new-features.json"
+ end
+
private
def last_installed_version_key
@@ -248,10 +253,6 @@ module DiscourseUpdates
"missing_version"
end
- def new_features_endpoint
- "https://meta.discourse.org/new-features.json"
- end
-
def new_features_key
"new_features"
end
diff --git a/spec/jobs/check_new_features_spec.rb b/spec/jobs/check_new_features_spec.rb
index 43fb9be37fa..ce6e0872137 100644
--- a/spec/jobs/check_new_features_spec.rb
+++ b/spec/jobs/check_new_features_spec.rb
@@ -15,8 +15,8 @@ RSpec.describe Jobs::CheckNewFeatures do
}
end
- def stub_meta_new_features_endpoint(*features)
- stub_request(:get, "https://meta.discourse.org/new-features.json").to_return(
+ def stub_new_features_endpoint(*features)
+ stub_request(:get, DiscourseUpdates.new_features_endpoint).to_return(
status: 200,
body: JSON.dump(features),
headers: {
@@ -43,7 +43,7 @@ RSpec.describe Jobs::CheckNewFeatures do
before do
DiscourseUpdates.stubs(:current_version).returns("2.8.1.beta13")
freeze_time
- stub_meta_new_features_endpoint(feature1, feature2, pending_feature)
+ stub_new_features_endpoint(feature1, feature2, pending_feature)
end
after { DiscourseUpdates.clean_state }