The personal finance app for everyone
Add env to toggle provider price syncs
Zach Gollwitzer0006b6f6ca7c
diff --git a/app/models/security/provided.rb b/app/models/security/provided.rbindex b342c9e5..e230b82f 100644--- a/app/models/security/provided.rb+++ b/app/models/security/provided.rb@@ -29,6 +29,8 @@ module Security::Providedenddef sync_provider_prices(start_date:, end_date: Date.current)+ return 0 unless ENV["PROVIDER_PRICE_SYNC_ENABLED"] == "true"+unless has_prices?Rails.logger.warn("Security id=#{id} ticker=#{ticker} is not known by provider, skipping price sync")return 0diff --git a/test/test_helper.rb b/test/test_helper.rbindex 23f98faa..b586da49 100644--- a/test/test_helper.rb+++ b/test/test_helper.rb@@ -13,6 +13,8 @@ ENV["RAILS_ENV"] ||= "test"# https://github.com/ged/ruby-pg/issues/538#issuecomment-1591629049ENV["PGGSSENCMODE"] = "disable"+ENV["PROVIDER_PRICE_SYNC_ENABLED"] = "true"+require "rails/test_help"require "minitest/mock"require "minitest/autorun"