diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 2f21cb9e588..ddf2656d182 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -214,7 +214,7 @@ class ApplicationController < ActionController::Base }, } - dynamic_settings_tree = Canvas::DynamicSettings.find(tree: :private) + dynamic_settings_tree = DynamicSettings.find(tree: :private) if dynamic_settings_tree["api_gateway_enabled"] == "true" @js_env[:API_GATEWAY_URI] = dynamic_settings_tree["api_gateway_uri"] end @@ -2089,7 +2089,7 @@ class ApplicationController < ActionController::Base def safe_domain_file_url(attachment, host_and_shard: nil, verifier: nil, download: false, return_url: nil, fallback_url: nil) # TODO: generalize this host_and_shard ||= HostUrl.file_host_with_shard(@domain_root_account || Account.default, request.host_with_port) host, shard = host_and_shard - config = Canvas::DynamicSettings.find(tree: :private, cluster: attachment.shard.database_server.id) + config = DynamicSettings.find(tree: :private, cluster: attachment.shard.database_server.id) if config["attachment_specific_file_domain"] == "true" separator = config["attachment_specific_file_domain_separator"] || "." host = "a#{attachment.shard.id}-#{attachment.local_id}#{separator}#{host}" @@ -2838,13 +2838,13 @@ class ApplicationController < ActionController::Base else return value_to_boolean(params[:force_stream]) if params.key?(:force_stream) - ::Canvas::DynamicSettings.find(tree: :private)["enable_template_streaming", failsafe: false] && + ::DynamicSettings.find(tree: :private)["enable_template_streaming", failsafe: false] && Setting.get("disable_template_streaming_for_#{controller_name}/#{action_name}", "false") != "true" end end def recaptcha_enabled? - Canvas::DynamicSettings.find(tree: :private)["recaptcha_server_key"].present? && @domain_root_account.self_registration_captcha? + DynamicSettings.find(tree: :private)["recaptcha_server_key"].present? && @domain_root_account.self_registration_captcha? end # Show Student View button on the following controller/action pages, as long as defined tabs are not hidden diff --git a/app/controllers/immersive_reader_controller.rb b/app/controllers/immersive_reader_controller.rb index bc4811970d8..a5bedd5ed1c 100644 --- a/app/controllers/immersive_reader_controller.rb +++ b/app/controllers/immersive_reader_controller.rb @@ -30,7 +30,7 @@ class ImmersiveReaderController < ApplicationController class ServiceError < StandardError; end def ir_config - @ir_config ||= YAML.safe_load(Canvas::DynamicSettings.find(tree: :private)["immersive_reader.yml"] || "{}").with_indifferent_access + @ir_config ||= YAML.safe_load(DynamicSettings.find(tree: :private)["immersive_reader.yml"] || "{}").with_indifferent_access end def require_config diff --git a/app/controllers/profile_controller.rb b/app/controllers/profile_controller.rb index 1d737c53b86..ae538836a05 100644 --- a/app/controllers/profile_controller.rb +++ b/app/controllers/profile_controller.rb @@ -500,7 +500,7 @@ class ProfileController < ApplicationController set_active_tab "content_shares" @context = @user.profile - ccv_settings = Canvas::DynamicSettings.find("common_cartridge_viewer") || {} + ccv_settings = DynamicSettings.find("common_cartridge_viewer") || {} js_env({ COMMON_CARTRIDGE_VIEWER_URL: ccv_settings["base_url"] }) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 25f29b90e10..f2166ce331d 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -2607,7 +2607,7 @@ class UsersController < ApplicationController # "expires_at": 1521667783000, # } def pandata_events_token - settings = Canvas::DynamicSettings.find("events", service: "pandata") + settings = DynamicSettings.find("events", service: "pandata") dk_ids = Setting.get("pandata_events_token_allowed_developer_key_ids", "").split(",") unless @access_token @@ -3141,7 +3141,7 @@ class UsersController < ApplicationController return nil unless @access_token.nil? response = CanvasHttp.post("https://www.google.com/recaptcha/api/siteverify", form_data: { - secret: Canvas::DynamicSettings.find(tree: :private)["recaptcha_server_key"], + secret: DynamicSettings.find(tree: :private)["recaptcha_server_key"], response: recaptcha_response }) diff --git a/app/helpers/datadog_rum_helper.rb b/app/helpers/datadog_rum_helper.rb index 578530a7aa4..ff3772a4034 100644 --- a/app/helpers/datadog_rum_helper.rb +++ b/app/helpers/datadog_rum_helper.rb @@ -72,7 +72,7 @@ module DatadogRumHelper end def datadog_rum_config - @datadog_rum_config ||= Canvas::DynamicSettings.find("datadog-rum", tree: "config", service: "canvas") + @datadog_rum_config ||= DynamicSettings.find("datadog-rum", tree: "config", service: "canvas") end def complete_config? diff --git a/app/helpers/full_story_helper.rb b/app/helpers/full_story_helper.rb index a888c586064..67c186fbe43 100644 --- a/app/helpers/full_story_helper.rb +++ b/app/helpers/full_story_helper.rb @@ -27,14 +27,14 @@ module FullStoryHelper # this session is already hooked up return if session.key?(:fullstory_enabled) - fsconfig = Canvas::DynamicSettings.find("fullstory", tree: "config", service: "canvas") + fsconfig = DynamicSettings.find("fullstory", tree: "config", service: "canvas") rate = fsconfig[:sampling_rate, failsafe: 0.0].to_f sample = rand session[:fullstory_enabled] = rate >= 0.0 && rate <= 1.0 && sample < rate end def fullstory_app_key - Canvas::DynamicSettings.find("fullstory", tree: "config", service: "canvas")[:app_key, failsafe: nil] + DynamicSettings.find("fullstory", tree: "config", service: "canvas")[:app_key, failsafe: nil] end def fullstory_enabled_for_session?(session) diff --git a/app/middleware/request_throttle.rb b/app/middleware/request_throttle.rb index 8ded1faaf1e..54cb2d7f82a 100644 --- a/app/middleware/request_throttle.rb +++ b/app/middleware/request_throttle.rb @@ -199,7 +199,7 @@ class RequestThrottle end def self.dynamic_settings - @dynamic_settings ||= YAML.safe_load(Canvas::DynamicSettings.find(tree: :private)["request_throttle.yml", failsafe: ""] || "") || {} + @dynamic_settings ||= YAML.safe_load(DynamicSettings.find(tree: :private)["request_throttle.yml", failsafe: ""] || "") || {} end def rate_limit_exceeded diff --git a/app/models/attachment.rb b/app/models/attachment.rb index 86b210364a3..640e6623071 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -1972,7 +1972,7 @@ class Attachment < ActiveRecord::Base class << self def clone_url_strand_overrides - @clone_url_strand_overrides ||= YAML.safe_load(Canvas::DynamicSettings.find(tree: :private)["clone_url_strand.yml"] || "{}") + @clone_url_strand_overrides ||= YAML.safe_load(DynamicSettings.find(tree: :private)["clone_url_strand.yml"] || "{}") end def reset_clone_url_strand_overrides diff --git a/app/models/canvadoc.rb b/app/models/canvadoc.rb index ab0eae50362..8f152c6e0d1 100644 --- a/app/models/canvadoc.rb +++ b/app/models/canvadoc.rb @@ -66,7 +66,7 @@ class Canvadoc < ActiveRecord::Base end def self.jwt_secret - secret = Canvas::DynamicSettings.find(service: "canvadoc", default_ttl: 5.minutes)["secret"] + secret = DynamicSettings.find(service: "canvadoc", default_ttl: 5.minutes)["secret"] Base64.decode64(secret) if secret end diff --git a/app/models/csp/account_helper.rb b/app/models/csp/account_helper.rb index 007492dc808..689a1e0ba4f 100644 --- a/app/models/csp/account_helper.rb +++ b/app/models/csp/account_helper.rb @@ -159,7 +159,7 @@ module Csp::AccountHelper def csp_files_domains(request) files_host = HostUrl.file_host(root_account, request.host_with_port) - config = Canvas::DynamicSettings.find(tree: :private, cluster: root_account.shard.database_server.id) + config = DynamicSettings.find(tree: :private, cluster: root_account.shard.database_server.id) if config["attachment_specific_file_domain"] == "true" separator = config["attachment_specific_file_domain_separator"] || "." files_host = if separator == "." @@ -174,6 +174,6 @@ module Csp::AccountHelper end def csp_logging_config - @config ||= YAML.safe_load(Canvas::DynamicSettings.find(tree: :private, cluster: shard.database_server.id)["csp_logging.yml"] || "{}") + @config ||= YAML.safe_load(DynamicSettings.find(tree: :private, cluster: shard.database_server.id)["csp_logging.yml"] || "{}") end end diff --git a/app/models/release_note.rb b/app/models/release_note.rb index f52b1333344..48667d9e7a8 100644 --- a/app/models/release_note.rb +++ b/app/models/release_note.rb @@ -351,7 +351,7 @@ class ReleaseNote end def settings - YAML.safe_load(Canvas::DynamicSettings.find(tree: :private)["release_notes.yml"] || "{}") + YAML.safe_load(DynamicSettings.find(tree: :private)["release_notes.yml"] || "{}") end def ddb_table_name diff --git a/app/models/user_learning_object_scopes.rb b/app/models/user_learning_object_scopes.rb index c7632677c0a..d5e0abe2777 100644 --- a/app/models/user_learning_object_scopes.rb +++ b/app/models/user_learning_object_scopes.rb @@ -292,7 +292,7 @@ module UserLearningObjectScopes # opts forwaded to course_ids_for_todo_lists def submissions_needing_grading_count(**opts) - if ::Canvas::DynamicSettings.find(tree: :private, cluster: Shard.current.database_server.id)["disable_needs_grading_queries", failsafe: false] + if ::DynamicSettings.find(tree: :private, cluster: Shard.current.database_server.id)["disable_needs_grading_queries", failsafe: false] return 0 end @@ -313,7 +313,7 @@ module UserLearningObjectScopes end def assignments_needing_grading(limit: ULOS_DEFAULT_LIMIT, scope_only: false, **opts) - if ::Canvas::DynamicSettings.find(tree: :private, cluster: Shard.current.database_server.id)["disable_needs_grading_queries"] + if ::DynamicSettings.find(tree: :private, cluster: Shard.current.database_server.id)["disable_needs_grading_queries"] return scope_only ? Assignment.none : [] end diff --git a/app/views/authentication_providers/_canvas_fields.html.erb b/app/views/authentication_providers/_canvas_fields.html.erb index e60e74e7248..ffd9a18f410 100644 --- a/app/views/authentication_providers/_canvas_fields.html.erb +++ b/app/views/authentication_providers/_canvas_fields.html.erb @@ -30,7 +30,7 @@ <%= f.radio_button :self_registration, 'observer', id: "self_registration_observers_#{presenter.id_suffix(aac)}", checked: aac.self_registration == 'observer' %> <%= f.label :self_registration, t('Observer Accounts Only'), for: "self_registration_observers_#{presenter.id_suffix(aac)}", class: 'ic-Label' %> - <% if Canvas::DynamicSettings.find(tree: :private)['recaptcha_server_key'] %> + <% if DynamicSettings.find(tree: :private)['recaptcha_server_key'] %>
<%= f.check_box :enable_captcha, class: 'enable_captcha_checkbox', id: "enable_captcha_#{presenter.id_suffix(aac)}" %> <%= f.label :enable_captcha, t('Require Captcha for Self Registration'), for: "enable_captcha_#{presenter.id_suffix(aac)}" %> diff --git a/config/application.rb b/config/application.rb index 81820ba96eb..3e7e5eb7998 100644 --- a/config/application.rb +++ b/config/application.rb @@ -151,10 +151,10 @@ module CanvasRails config.middleware.use Rack::Chunked config.middleware.use Rack::Deflater, if: lambda { |*| - ::Canvas::DynamicSettings.find(tree: :private)["enable_rack_deflation", failsafe: true] + ::DynamicSettings.find(tree: :private)["enable_rack_deflation", failsafe: true] } config.middleware.use Rack::Brotli, if: lambda { |*| - ::Canvas::DynamicSettings.find(tree: :private)["enable_rack_brotli", failsafe: true] + ::DynamicSettings.find(tree: :private)["enable_rack_brotli", failsafe: true] } config.i18n.load_path << Rails.root.join("config/locales/locales.yml") diff --git a/config/initializers/delayed_job.rb b/config/initializers/delayed_job.rb index 3de6d6eae66..08d26466719 100644 --- a/config/initializers/delayed_job.rb +++ b/config/initializers/delayed_job.rb @@ -109,7 +109,7 @@ end module DelayedJobConfig class << self def config - @config ||= YAML.safe_load(Canvas::DynamicSettings.find(tree: :private)["delayed_jobs.yml"] || "{}") + @config ||= YAML.safe_load(DynamicSettings.find(tree: :private)["delayed_jobs.yml"] || "{}") end def strands_to_send_to_statsd diff --git a/config/initializers/inst_statsd.rb b/config/initializers/inst_statsd.rb index 2c6f83e41bd..1483845620c 100644 --- a/config/initializers/inst_statsd.rb +++ b/config/initializers/inst_statsd.rb @@ -20,7 +20,7 @@ # Initialize canvas statsd configuration. See config/statsd.yml.example. Rails.configuration.to_prepare do - settings = YAML.safe_load(Canvas::DynamicSettings.find(tree: :private)["statsd.yml"] || "") + settings = YAML.safe_load(DynamicSettings.find(tree: :private)["statsd.yml"] || "") settings ||= ConfigFile.load("statsd").dup settings ||= {} InstStatsd.settings = settings diff --git a/config/initializers/live_events.rb b/config/initializers/live_events.rb index 54a8979d126..a625d8efd8a 100644 --- a/config/initializers/live_events.rb +++ b/config/initializers/live_events.rb @@ -36,7 +36,7 @@ Rails.configuration.to_prepare do LiveEvents.cache = Rails.cache LiveEvents.statsd = InstStatsd::Statsd LiveEvents.max_queue_size = -> { Setting.get("live_events_max_queue_size", 5000).to_i } - LiveEvents.settings = -> { Canvas::DynamicSettings.find("live-events", default_ttl: 2.hours) } + LiveEvents.settings = -> { DynamicSettings.find("live-events", default_ttl: 2.hours) } LiveEvents.aws_credentials = lambda do |settings| if settings["vault_credential_path"] Canvas::Vault::AwsCredentialProvider.new(settings["vault_credential_path"]) diff --git a/config/initializers/rack.rb b/config/initializers/rack.rb index e15f8558406..46c4c6411be 100644 --- a/config/initializers/rack.rb +++ b/config/initializers/rack.rb @@ -24,7 +24,7 @@ Rack::Utils.multipart_part_limit = 256 # default is 128 module EnableRackChunking def chunkable_version?(*) return false if defined?(PactConfig) - return super if ::Rails.env.test? || ::Canvas::DynamicSettings.find(tree: :private)["enable_rack_chunking", failsafe: true] + return super if ::Rails.env.test? || ::DynamicSettings.find(tree: :private)["enable_rack_chunking", failsafe: true] false end diff --git a/gems/dynamic_settings/README.md b/gems/dynamic_settings/README.md index 7c020d30bee..4f1a0817e4d 100644 --- a/gems/dynamic_settings/README.md +++ b/gems/dynamic_settings/README.md @@ -27,7 +27,7 @@ Fetch the recaptcha_server_key config value from the root of the Private Local C Create an object to query the live-events configuration keyspace with a long cache TTL and use it to fetch some keys: ```ruby -le_settings = Canvas::DynamicSettings.find('live-events', default_ttl: 2.hours) +le_settings = DynamicSettings.find('live-events', default_ttl: 2.hours) le_settings['stream_name'] le_settings['acl_token'] ``` @@ -38,9 +38,9 @@ Fetch the disable_needs_grading_queries config value, looking first in a keyspac ## Fallback Rules -An initializer configures the Canvas::DynamicSettings with an environment, e.g. DynamicSettings.config = { 'environment' => 'production' }, which influences the fallback paths followed for any query. The easiest way to describe the behavior is probably through a set of examples, so here we go. +An initializer configures the DynamicSettings with an environment, e.g. DynamicSettings.config = { 'environment' => 'production' }, which influences the fallback paths followed for any query. The easiest way to describe the behavior is probably through a set of examples, so here we go. -Query: Canvas::DynamicSettings.find()['key'] +Query: DynamicSettings.find()['key'] Search paths: ```bash diff --git a/lib/api/v1/account.rb b/lib/api/v1/account.rb index ed252f3a8f8..6cc7c1889bd 100644 --- a/lib/api/v1/account.rb +++ b/lib/api/v1/account.rb @@ -62,7 +62,7 @@ module Api::V1::Account hash["terms_required"] = account.terms_required? hash["terms_of_use_url"] = terms_of_use_url hash["privacy_policy_url"] = privacy_policy_url - hash["recaptcha_key"] = account.self_registration_captcha? && Canvas::DynamicSettings.find(tree: :private)["recaptcha_client_key"] + hash["recaptcha_key"] = account.self_registration_captcha? && DynamicSettings.find(tree: :private)["recaptcha_client_key"] end end if includes.include?("services") && account.grants_right?(user, session, :manage_account_settings) diff --git a/lib/api/v1/planner_item.rb b/lib/api/v1/planner_item.rb index e97d38b9348..45eeade667a 100644 --- a/lib/api/v1/planner_item.rb +++ b/lib/api/v1/planner_item.rb @@ -258,7 +258,7 @@ module Api::V1::PlannerItem end def online_meeting_url(event_description, event_location) - config = Canvas::DynamicSettings.find("canvas", tree: "config", service: "canvas") + config = DynamicSettings.find("canvas", tree: "config", service: "canvas") default_regex = <<~'REGEX' https:\/\/[\w-]+\.zoom\.us\/\d+(\?[\w\/\-=%]*)? https:\/\/[\w-]+\.zoom\.us\/my\/[\w.]+(\?[\w\/\-=%]*)? diff --git a/lib/basic_lti/sourcedid.rb b/lib/basic_lti/sourcedid.rb index 0cea3e99447..4d4e480ebdc 100644 --- a/lib/basic_lti/sourcedid.rb +++ b/lib/basic_lti/sourcedid.rb @@ -106,11 +106,11 @@ module BasicLTI end def self.signing_secret - Canvas::DynamicSettings.find["lti-signing-secret"] + DynamicSettings.find["lti-signing-secret"] end def self.encryption_secret - Canvas::DynamicSettings.find["lti-encryption-secret"] + DynamicSettings.find["lti-encryption-secret"] end end end diff --git a/lib/canvas.rb b/lib/canvas.rb index 72e7ec12629..0b0ffc11ade 100644 --- a/lib/canvas.rb +++ b/lib/canvas.rb @@ -50,7 +50,7 @@ module Canvas def self.cache_store_config_for(cluster) yaml_config = ConfigFile.load("cache_store", cluster) - consul_config = YAML.safe_load(Canvas::DynamicSettings.find(tree: :private, cluster: cluster)["cache_store.yml"] || "{}") || {} + consul_config = YAML.safe_load(DynamicSettings.find(tree: :private, cluster: cluster)["cache_store.yml"] || "{}") || {} consul_config = consul_config.with_indifferent_access if consul_config.is_a?(Hash) consul_config.presence || yaml_config diff --git a/lib/canvas/apm.rb b/lib/canvas/apm.rb index ccd9ba91c94..b26bf46e07e 100644 --- a/lib/canvas/apm.rb +++ b/lib/canvas/apm.rb @@ -64,9 +64,9 @@ module Canvas def config return @_config if @_config.present? - dynamic_settings = Canvas::DynamicSettings.find(tree: :private) + dynamic_settings = DynamicSettings.find(tree: :private) if canvas_cluster.present? - dynamic_settings = Canvas::DynamicSettings.find(tree: :private, cluster: canvas_cluster) + dynamic_settings = DynamicSettings.find(tree: :private, cluster: canvas_cluster) end @_config = YAML.safe_load(dynamic_settings["datadog_apm.yml"] || "{}") end diff --git a/lib/cuty_capt.rb b/lib/cuty_capt.rb index 3af45f98d7d..8083c2b7069 100644 --- a/lib/cuty_capt.rb +++ b/lib/cuty_capt.rb @@ -57,7 +57,7 @@ class CutyCapt return @@config if defined?(@@config) && @@config setting = begin - consul_config = Canvas::DynamicSettings.find(tree: :private)["cutycapt.yml"] + consul_config = DynamicSettings.find(tree: :private)["cutycapt.yml"] (consul_config && YAML.safe_load(consul_config).with_indifferent_access) || ConfigFile.load("cutycapt") || {} end setting = setting.symbolize_keys diff --git a/lib/feature_flags.rb b/lib/feature_flags.rb index 6198e48600a..99bc5b81493 100644 --- a/lib/feature_flags.rb +++ b/lib/feature_flags.rb @@ -217,7 +217,7 @@ module FeatureFlags context_type = self.class.name return unless %w[Course Account].include?(context_type) - config = Canvas::DynamicSettings.find("feature_analytics", tree: :private) + config = DynamicSettings.find("feature_analytics", tree: :private) cache_expiry = (config[:cache_expiry] || 1.day).to_i sampling_rate = (config[:sampling_rate] || 0).to_f return unless rand < sampling_rate diff --git a/lib/inst_fs.rb b/lib/inst_fs.rb index 4f61d4cebbf..fed1f6b617e 100644 --- a/lib/inst_fs.rb +++ b/lib/inst_fs.rb @@ -277,7 +277,7 @@ module InstFS private def setting(key) - Canvas::DynamicSettings.find(service: "inst-fs", default_ttl: 5.minutes)[key] + DynamicSettings.find(service: "inst-fs", default_ttl: 5.minutes)[key] end def service_url(path, query_params = nil) diff --git a/lib/math_man.rb b/lib/math_man.rb index d7869251a00..35b8568c72e 100644 --- a/lib/math_man.rb +++ b/lib/math_man.rb @@ -59,7 +59,7 @@ module MathMan end def dynamic_settings - Canvas::DynamicSettings.find("math-man") + DynamicSettings.find("math-man") end end end diff --git a/lib/multi_cache.rb b/lib/multi_cache.rb index e9a54942169..d17504b42b9 100644 --- a/lib/multi_cache.rb +++ b/lib/multi_cache.rb @@ -24,7 +24,7 @@ class MultiCache def cache unless defined?(@multi_cache) - ha_cache_config = YAML.safe_load(Canvas::DynamicSettings.find(tree: :private, cluster: Canvas.cluster)["ha_cache.yml"] || "{}").symbolize_keys || {} + ha_cache_config = YAML.safe_load(DynamicSettings.find(tree: :private, cluster: Canvas.cluster)["ha_cache.yml"] || "{}").symbolize_keys || {} @multi_cache = if ha_cache_config[:cache_store] ha_cache_config[:url] = ha_cache_config[:servers] if ha_cache_config[:servers] ActiveSupport::Cache.lookup_store(ha_cache_config[:cache_store].to_sym, ha_cache_config) diff --git a/lib/services/address_book.rb b/lib/services/address_book.rb index e8cd90d783d..71f3b4f0471 100644 --- a/lib/services/address_book.rb +++ b/lib/services/address_book.rb @@ -123,7 +123,7 @@ module Services private def setting(key) - Canvas::DynamicSettings.find("address-book", default_ttl: 5.minutes)[key, failsafe: nil] + DynamicSettings.find("address-book", default_ttl: 5.minutes)[key, failsafe: nil] end def app_host diff --git a/lib/services/feature_analytics_service.rb b/lib/services/feature_analytics_service.rb index 84e6cc90d2f..deee1cec8cb 100644 --- a/lib/services/feature_analytics_service.rb +++ b/lib/services/feature_analytics_service.rb @@ -42,7 +42,7 @@ module Services end def config - @config ||= Canvas::DynamicSettings.find("feature_analytics", tree: :private) || {} + @config ||= DynamicSettings.find("feature_analytics", tree: :private) || {} end end end diff --git a/lib/services/live_events_subscription_service.rb b/lib/services/live_events_subscription_service.rb index 46a59ccccae..fb68977105a 100644 --- a/lib/services/live_events_subscription_service.rb +++ b/lib/services/live_events_subscription_service.rb @@ -108,7 +108,7 @@ module Services end def settings - Canvas::DynamicSettings.find("live-events-subscription-service", default_ttl: 5.minutes) + DynamicSettings.find("live-events-subscription-service", default_ttl: 5.minutes) end def tool_proxy_jwt_body(tool_proxy, options = {}) diff --git a/lib/services/rich_content.rb b/lib/services/rich_content.rb index 8937d9104c2..dbc7699707d 100644 --- a/lib/services/rich_content.rb +++ b/lib/services/rich_content.rb @@ -51,7 +51,7 @@ module Services private def service_settings - settings = Canvas::DynamicSettings.find("rich-content-service", default_ttl: 5.minutes) + settings = DynamicSettings.find("rich-content-service", default_ttl: 5.minutes) { RICH_CONTENT_APP_HOST: settings["app-host", failsafe: "error"], RICH_CONTENT_SKIP_SIDEBAR: settings["skip-sidebar", failsafe: nil] diff --git a/spec/apis/v1/users_api_spec.rb b/spec/apis/v1/users_api_spec.rb index 7275710de47..0e9531dcaa4 100644 --- a/spec/apis/v1/users_api_spec.rb +++ b/spec/apis/v1/users_api_spec.rb @@ -3006,9 +3006,9 @@ describe "Users API", type: :request do end before do - allow(Canvas::DynamicSettings).to receive(:find) + allow(DynamicSettings).to receive(:find) .with(any_args).and_call_original - allow(Canvas::DynamicSettings).to receive(:find) + allow(DynamicSettings).to receive(:find) .with("events", service: "pandata").and_return(fake_secrets) end diff --git a/spec/contracts/service_consumers/api/provider_states_for_consumer/oauth_provider_states.rb b/spec/contracts/service_consumers/api/provider_states_for_consumer/oauth_provider_states.rb index a065bd5bafe..e4cd2f2e154 100644 --- a/spec/contracts/service_consumers/api/provider_states_for_consumer/oauth_provider_states.rb +++ b/spec/contracts/service_consumers/api/provider_states_for_consumer/oauth_provider_states.rb @@ -157,14 +157,14 @@ Pact.provider_states_for PactConfig::Consumers::ALL do allow_any_instance_of(Canvas::Security::JwtValidator).to receive(:exp).and_return(true) # DynamicSettings is not available on Jenkins -- need to stub it to return these values. - allow(Canvas::DynamicSettings).to receive(:find).with(any_args).and_call_original - allow(Canvas::DynamicSettings).to receive(:find).with("canvas").and_return( + allow(DynamicSettings).to receive(:find).with(any_args).and_call_original + allow(DynamicSettings).to receive(:find).with("canvas").and_return( { "signing-secret" => "astringthatisactually32byteslong", "encryption-secret" => "astringthatisactually32byteslong" } ) - allow(Canvas::DynamicSettings).to receive(:find) + allow(DynamicSettings).to receive(:find) .with("live-events-subscription-service", any_args).and_return({ "app-host" => ENV.fetch("SUBSCRIPTION_SERVICE_HOST", "http://les.docker:80") }) diff --git a/spec/controllers/application_controller_spec.rb b/spec/controllers/application_controller_spec.rb index 8a109383267..41c5c039eec 100644 --- a/spec/controllers/application_controller_spec.rb +++ b/spec/controllers/application_controller_spec.rb @@ -439,7 +439,7 @@ RSpec.describe ApplicationController do end it "loads gateway uri from dynamic settings" do - allow(Canvas::DynamicSettings).to receive(:find).and_return({ + allow(DynamicSettings).to receive(:find).and_return({ "api_gateway_enabled" => "true", "api_gateway_uri" => "http://the-gateway/graphql" }) @@ -448,7 +448,7 @@ RSpec.describe ApplicationController do end it "will not expose gateway uri from dynamic settings if not enabled" do - allow(Canvas::DynamicSettings).to receive(:find).and_return({ + allow(DynamicSettings).to receive(:find).and_return({ "api_gateway_enabled" => "false", "api_gateway_uri" => "http://the-gateway/graphql" }) diff --git a/spec/controllers/docviewer_audit_events_controller_spec.rb b/spec/controllers/docviewer_audit_events_controller_spec.rb index 0a07e30e1ac..23a4ff099ff 100644 --- a/spec/controllers/docviewer_audit_events_controller_spec.rb +++ b/spec/controllers/docviewer_audit_events_controller_spec.rb @@ -35,8 +35,8 @@ describe DocviewerAuditEventsController do before do # Assignment.create! will hit MultiCache, and if a default stub doesn't # exist, the stub with args will throw an error. - allow(Canvas::DynamicSettings).to receive(:find).and_return({}) - allow(Canvas::DynamicSettings).to receive(:find).with(service: "canvadoc", default_ttl: 5.minutes).and_return( + allow(DynamicSettings).to receive(:find).and_return({}) + allow(DynamicSettings).to receive(:find).with(service: "canvadoc", default_ttl: 5.minutes).and_return( { "secret" => @encoded64_secret } ) end diff --git a/spec/controllers/eportfolios_controller_spec.rb b/spec/controllers/eportfolios_controller_spec.rb index 62b7aaff06f..d84c95ddfbd 100644 --- a/spec/controllers/eportfolios_controller_spec.rb +++ b/spec/controllers/eportfolios_controller_spec.rb @@ -62,8 +62,8 @@ describe EportfoliosController do end before do - allow(Canvas::DynamicSettings).to receive(:find).with(any_args).and_call_original - allow(Canvas::DynamicSettings).to receive(:find).with("canvas").and_return(fake_secrets) + allow(DynamicSettings).to receive(:find).with(any_args).and_call_original + allow(DynamicSettings).to receive(:find).with("canvas").and_return(fake_secrets) end it "assigns variables" do @@ -74,7 +74,7 @@ describe EportfoliosController do end it "exposes the feature state for rich content service to js_env" do - allow(Canvas::DynamicSettings).to receive(:find).with("rich-content-service", default_ttl: 5.minutes).and_return( + allow(DynamicSettings).to receive(:find).with("rich-content-service", default_ttl: 5.minutes).and_return( DynamicSettings::FallbackProxy.new("app-host" => "rce.docker", "cdn-host" => "rce.docker") ) diff --git a/spec/controllers/profile_controller_spec.rb b/spec/controllers/profile_controller_spec.rb index c7c2b81c389..8e89ddeaa19 100644 --- a/spec/controllers/profile_controller_spec.rb +++ b/spec/controllers/profile_controller_spec.rb @@ -271,7 +271,7 @@ describe ProfileController do end it "shows if user has any non-student enrollments" do - allow(Canvas::DynamicSettings).to receive(:find).and_return({ "base_url" => "the_ccv_url" }) + allow(DynamicSettings).to receive(:find).and_return({ "base_url" => "the_ccv_url" }) user_session(@teacher) get "content_shares", params: { user_id: @teacher.id } expect(response).to render_template("content_shares") diff --git a/spec/controllers/security_controller_spec.rb b/spec/controllers/security_controller_spec.rb index 5ae9eb73b76..7ed5f11237b 100644 --- a/spec/controllers/security_controller_spec.rb +++ b/spec/controllers/security_controller_spec.rb @@ -23,7 +23,7 @@ RSpec.describe SecurityController, type: :request do let(:json) { JSON.parse(response.body) } let(:fallback_proxy) do - Canvas::DynamicSettings::FallbackProxy.new({ + DynamicSettings::FallbackProxy.new({ CanvasSecurity::KeyStorage::PAST => CanvasSecurity::KeyStorage.new_key, CanvasSecurity::KeyStorage::PRESENT => CanvasSecurity::KeyStorage.new_key, CanvasSecurity::KeyStorage::FUTURE => CanvasSecurity::KeyStorage.new_key @@ -31,7 +31,7 @@ RSpec.describe SecurityController, type: :request do end before do - allow(Canvas::DynamicSettings).to receive(:kv_proxy).and_return(fallback_proxy) + allow(DynamicSettings).to receive(:kv_proxy).and_return(fallback_proxy) end it "returns ok status" do diff --git a/spec/controllers/users_controller_spec.rb b/spec/controllers/users_controller_spec.rb index 95bb47d6b96..7fc5f19ce12 100644 --- a/spec/controllers/users_controller_spec.rb +++ b/spec/controllers/users_controller_spec.rb @@ -1079,7 +1079,7 @@ describe UsersController do "error-codes" => ["missing-input-response"] }.to_json) # Fallback for any dynamicsettings call that isn't mocked below - allow(Canvas::DynamicSettings).to receive(:find).with(any_args).and_call_original + allow(DynamicSettings).to receive(:find).with(any_args).and_call_original end after do @@ -1087,22 +1087,22 @@ describe UsersController do end it "returns nil if there is no token" do - allow(Canvas::DynamicSettings).to receive(:find).with(tree: :private).and_return({ "recaptcha_server_key" => nil }) + allow(DynamicSettings).to receive(:find).with(tree: :private).and_return({ "recaptcha_server_key" => nil }) expect(subject.send(:validate_recaptcha, nil)).to be_nil end it "returns nil for valid recaptcha submissions" do - allow(Canvas::DynamicSettings).to receive(:find).with(tree: :private).and_return({ "recaptcha_server_key" => "test-token" }) + allow(DynamicSettings).to receive(:find).with(tree: :private).and_return({ "recaptcha_server_key" => "test-token" }) expect(subject.send(:validate_recaptcha, "valid-submit-key")).to be_nil end it "returns an error for missing recaptcha submissions" do - allow(Canvas::DynamicSettings).to receive(:find).with(tree: :private).and_return({ "recaptcha_server_key" => "test-token" }) + allow(DynamicSettings).to receive(:find).with(tree: :private).and_return({ "recaptcha_server_key" => "test-token" }) expect(subject.send(:validate_recaptcha, nil)).not_to be_nil end it "returns an error for invalid recaptcha submissions" do - allow(Canvas::DynamicSettings).to receive(:find).with(tree: :private).and_return({ "recaptcha_server_key" => "test-token" }) + allow(DynamicSettings).to receive(:find).with(tree: :private).and_return({ "recaptcha_server_key" => "test-token" }) expect(subject.send(:validate_recaptcha, "invalid-submit-key")).not_to be_nil end end diff --git a/spec/factories/account_factory.rb b/spec/factories/account_factory.rb index 525da3887ea..81d2c400898 100644 --- a/spec/factories/account_factory.rb +++ b/spec/factories/account_factory.rb @@ -24,13 +24,13 @@ module Factories def stub_rcs_config # make sure this is loaded first - allow(Canvas::DynamicSettings).to receive(:find).with(any_args).and_call_original - allow(Canvas::DynamicSettings).to receive(:find).with("rich-content-service", default_ttl: 5.minutes).and_return( + allow(DynamicSettings).to receive(:find).with(any_args).and_call_original + allow(DynamicSettings).to receive(:find).with("rich-content-service", default_ttl: 5.minutes).and_return( DynamicSettings::FallbackProxy.new( "app-host": ENV["RCE_HOST"] || "http://localhost:3001" ) ) - allow(Canvas::DynamicSettings).to receive(:find).with("canvas").and_return( + allow(DynamicSettings).to receive(:find).with("canvas").and_return( DynamicSettings::FallbackProxy.new( "signing-secret" => "astringthatisactually32byteslong", "encryption-secret" => "astringthatisactually32byteslong" @@ -39,8 +39,8 @@ module Factories end def stub_common_cartridge_url - allow(Canvas::DynamicSettings).to receive(:find).with(any_args).and_call_original - allow(Canvas::DynamicSettings).to receive(:find).with("common_cartridge_viewer", default_ttl: 5.minutes).and_return( + allow(DynamicSettings).to receive(:find).with(any_args).and_call_original + allow(DynamicSettings).to receive(:find).with("common_cartridge_viewer", default_ttl: 5.minutes).and_return( ActiveSupport::HashWithIndifferentAccess.new({ "app-host": "http://common-cartridge-viewer.netlify.com/" }) ) end diff --git a/spec/helpers/datadog_rum_helper_spec.rb b/spec/helpers/datadog_rum_helper_spec.rb index fd98035694e..0610b6bde3a 100644 --- a/spec/helpers/datadog_rum_helper_spec.rb +++ b/spec/helpers/datadog_rum_helper_spec.rb @@ -37,8 +37,8 @@ describe DatadogRumHelper do end before do - allow(Canvas::DynamicSettings).to receive(:find).and_call_original - allow(Canvas::DynamicSettings).to( + allow(DynamicSettings).to receive(:find).and_call_original + allow(DynamicSettings).to( receive(:find).with("datadog-rum", tree: "config", service: "canvas").and_return(datadog_rum_config) ) allow(self).to receive(:random).and_return(0.5) diff --git a/spec/lib/address_book/service_spec.rb b/spec/lib/address_book/service_spec.rb index 7f8bc6dc563..f4abe4bdda8 100644 --- a/spec/lib/address_book/service_spec.rb +++ b/spec/lib/address_book/service_spec.rb @@ -19,8 +19,8 @@ describe AddressBook::Service do before do - allow(Canvas::DynamicSettings).to receive(:find).with(any_args).and_call_original - allow(Canvas::DynamicSettings).to receive(:find) + allow(DynamicSettings).to receive(:find).with(any_args).and_call_original + allow(DynamicSettings).to receive(:find) .with("address-book", anything) .and_return({ "app-host" => "http://test.host" }) diff --git a/spec/lib/basic_lti/basic_outcomes_spec.rb b/spec/lib/basic_lti/basic_outcomes_spec.rb index b22120d15d8..909ce38baef 100644 --- a/spec/lib/basic_lti/basic_outcomes_spec.rb +++ b/spec/lib/basic_lti/basic_outcomes_spec.rb @@ -191,7 +191,7 @@ describe BasicLTI::BasicOutcomes do "lti-signing-secret" => "signing-secret-vp04BNqApwdwUYPUI", "lti-encryption-secret" => "encryption-secret-5T14NjaTbcYjc4" } - allow(Canvas::DynamicSettings).to receive(:find) { dynamic_settings } + allow(DynamicSettings).to receive(:find) { dynamic_settings } end let(:jwt_source_id) do diff --git a/spec/lib/basic_lti/sourcedid_spec.rb b/spec/lib/basic_lti/sourcedid_spec.rb index f2901070aef..737ede3bad2 100644 --- a/spec/lib/basic_lti/sourcedid_spec.rb +++ b/spec/lib/basic_lti/sourcedid_spec.rb @@ -43,7 +43,7 @@ describe BasicLTI::Sourcedid do "lti-encryption-secret" => "encryption-secret-5T14NjaTbcYjc4", } - allow(Canvas::DynamicSettings).to receive(:find).and_return(fake_secrets) + allow(DynamicSettings).to receive(:find).and_return(fake_secrets) end it "creates a signed and encrypted sourcedid" do diff --git a/spec/lib/canvas/apm_spec.rb b/spec/lib/canvas/apm_spec.rb index 19fea824060..13743d03b27 100644 --- a/spec/lib/canvas/apm_spec.rb +++ b/spec/lib/canvas/apm_spec.rb @@ -21,14 +21,14 @@ require_relative "apm_common" describe Canvas::Apm do after do - Canvas::DynamicSettings.config = nil - Canvas::DynamicSettings.reset_cache! - Canvas::DynamicSettings.fallback_data = nil + DynamicSettings.config = nil + DynamicSettings.reset_cache! + DynamicSettings.fallback_data = nil Canvas::Apm.reset! end def inject_apm_settings(yaml_string) - Canvas::DynamicSettings.fallback_data = { + DynamicSettings.fallback_data = { private: { canvas: { "datadog_apm.yml": yaml_string @@ -49,7 +49,7 @@ describe Canvas::Apm do inject_apm_settings("sample_rate: 0.5\nhost_sample_rate: 1.0") expect(Canvas::Apm).to_not be_analytics_enabled Canvas::Apm.reset! - Canvas::DynamicSettings.reset_cache! + DynamicSettings.reset_cache! inject_apm_settings("sample_rate: 0.5\nhost_sample_rate: 1.0\napp_analytics_enabled: false") expect(Canvas::Apm).to_not be_analytics_enabled end @@ -58,7 +58,7 @@ describe Canvas::Apm do describe ".configured?" do it "is false for empty config" do - Canvas::DynamicSettings.fallback_data = {} + DynamicSettings.fallback_data = {} expect(Canvas::Apm.configured?).to eq(false) end @@ -112,7 +112,7 @@ describe Canvas::Apm do around do |example| Canvas::Apm.reset! - Canvas::DynamicSettings.fallback_data = { + DynamicSettings.fallback_data = { private: { canvas: { "datadog_apm.yml": "sample_rate: 1.0\nhost_sample_rate: 1.0" @@ -164,7 +164,7 @@ describe Canvas::Apm do it "still yields if there is no configuration" do Canvas::Apm.reset! - Canvas::DynamicSettings.fallback_data = { + DynamicSettings.fallback_data = { private: { canvas: { "datadog_apm.yml": "sample_rate: 0.0\nhost_sample_rate: 0.0" diff --git a/spec/lib/inst_fs_spec.rb b/spec/lib/inst_fs_spec.rb index f59039ad43d..a5359370ae9 100644 --- a/spec/lib/inst_fs_spec.rb +++ b/spec/lib/inst_fs_spec.rb @@ -29,8 +29,8 @@ describe InstFS do before do allow(InstFS).to receive(:enabled?).and_return(true) - allow(Canvas::DynamicSettings).to receive(:find).with(any_args).and_call_original - allow(Canvas::DynamicSettings).to receive(:find) + allow(DynamicSettings).to receive(:find).with(any_args).and_call_original + allow(DynamicSettings).to receive(:find) .with(service: "inst-fs", default_ttl: 5.minutes) .and_return(settings_hash) end @@ -560,8 +560,8 @@ describe InstFS do context "settings not set" do before do - allow(Canvas::DynamicSettings).to receive(:find).with(any_args).and_call_original - allow(Canvas::DynamicSettings).to receive(:find).with(service: "inst-fs") + allow(DynamicSettings).to receive(:find).with(any_args).and_call_original + allow(DynamicSettings).to receive(:find).with(service: "inst-fs") .and_return({ "app-host" => nil, "secret" => nil diff --git a/spec/lib/lti/permission_checker_spec.rb b/spec/lib/lti/permission_checker_spec.rb index 1eda4848527..f8b104b0f97 100644 --- a/spec/lib/lti/permission_checker_spec.rb +++ b/spec/lib/lti/permission_checker_spec.rb @@ -35,15 +35,15 @@ describe Lti::PermissionChecker do before do allow_any_instance_of(AssignmentConfigurationToolLookup).to receive(:create_subscription).and_return true allow_any_instance_of(AssignmentConfigurationToolLookup).to receive(:destroy_subscription).and_return true - @original_fallback = Canvas::DynamicSettings.fallback_data - Canvas::DynamicSettings.fallback_data = { + @original_fallback = DynamicSettings.fallback_data + DynamicSettings.fallback_data = { "canvas" => {}, "live-events-subscription-service" => {}, } end after do - Canvas::DynamicSettings.fallback_data = @original_fallback + DynamicSettings.fallback_data = @original_fallback end let(:assignment) do diff --git a/spec/lib/lti/variable_expander_spec.rb b/spec/lib/lti/variable_expander_spec.rb index 871bdb10e72..10da340b3c9 100644 --- a/spec/lib/lti/variable_expander_spec.rb +++ b/spec/lib/lti/variable_expander_spec.rb @@ -1147,11 +1147,11 @@ module Lti context "when the RCS in configured" do before do - allow(Canvas::DynamicSettings).to receive(:find) + allow(DynamicSettings).to receive(:find) .with(any_args) .and_call_original - allow(Canvas::DynamicSettings).to receive(:find) + allow(DynamicSettings).to receive(:find) .with("rich-content-service", default_ttl: 5.minutes) .and_return(DynamicSettings::FallbackProxy.new({ "app-host" => app_host })) end diff --git a/spec/lib/math_man_spec.rb b/spec/lib/math_man_spec.rb index ac6deb0dd28..2f171b076c4 100644 --- a/spec/lib/math_man_spec.rb +++ b/spec/lib/math_man_spec.rb @@ -27,8 +27,8 @@ describe MathMan do let(:use_for_svg) { false } before do - @original_fallback = Canvas::DynamicSettings.fallback_data - Canvas::DynamicSettings.fallback_data = { + @original_fallback = DynamicSettings.fallback_data + DynamicSettings.fallback_data = { config: { canvas: { "math-man": { @@ -47,7 +47,7 @@ describe MathMan do end after do - Canvas::DynamicSettings.fallback_data = @original_fallback + DynamicSettings.fallback_data = @original_fallback end describe ".url_for" do @@ -63,7 +63,7 @@ describe MathMan do end it "errors if DynamicSettings is not configured" do - Canvas::DynamicSettings.fallback_data = nil + DynamicSettings.fallback_data = nil expect { MathMan.url_for(latex: latex, target: :mml) }.to raise_error MathMan::InvalidConfigurationError end @@ -87,7 +87,7 @@ describe MathMan do end it "does not error if DynamicSettings is not configured" do - Canvas::DynamicSettings.fallback_data = nil + DynamicSettings.fallback_data = nil expect(MathMan.use_for_mml?).to be_falsey end @@ -111,7 +111,7 @@ describe MathMan do end it "does not error if DynamicSettings is not configured" do - Canvas::DynamicSettings.fallback_data = nil + DynamicSettings.fallback_data = nil expect(MathMan.use_for_svg?).to be_falsey end diff --git a/spec/lib/microsoft_sync/login_service_spec.rb b/spec/lib/microsoft_sync/login_service_spec.rb index 34363275984..ec0940c0939 100644 --- a/spec/lib/microsoft_sync/login_service_spec.rb +++ b/spec/lib/microsoft_sync/login_service_spec.rb @@ -31,8 +31,8 @@ describe MicrosoftSync::LoginService do context "when not configured" do before do - allow(Canvas::DynamicSettings).to receive(:find).with(any_args).and_call_original - allow(Canvas::DynamicSettings).to receive(:find).with("microsoft-sync").and_return(nil) + allow(DynamicSettings).to receive(:find).with(any_args).and_call_original + allow(DynamicSettings).to receive(:find).with("microsoft-sync").and_return(nil) end it 'returns an error "MicrosoftSync not configured"' do @@ -51,8 +51,8 @@ describe MicrosoftSync::LoginService do context "when Microsoft returns a response" do before do - allow(Canvas::DynamicSettings).to receive(:find).with(any_args).and_call_original - allow(Canvas::DynamicSettings).to receive(:find).with("microsoft-sync").and_return({ + allow(DynamicSettings).to receive(:find).with(any_args).and_call_original + allow(DynamicSettings).to receive(:find).with("microsoft-sync").and_return({ "client-id" => "theclientid", "client-secret" => "thesecret" }) diff --git a/spec/lib/services/live_events_subscription_service_spec.rb b/spec/lib/services/live_events_subscription_service_spec.rb index 20875d10e62..dc88bf0cc69 100644 --- a/spec/lib/services/live_events_subscription_service_spec.rb +++ b/spec/lib/services/live_events_subscription_service_spec.rb @@ -28,8 +28,8 @@ module Services context "service unavailable" do before do - allow(Canvas::DynamicSettings).to receive(:find).with(any_args).and_call_original - allow(Canvas::DynamicSettings).to receive(:find) + allow(DynamicSettings).to receive(:find).with(any_args).and_call_original + allow(DynamicSettings).to receive(:find) .with("live-events-subscription-service", default_ttl: 5.minutes) .and_return(nil) end @@ -43,12 +43,12 @@ module Services context "service available" do before do - allow(Canvas::DynamicSettings).to receive(:find) + allow(DynamicSettings).to receive(:find) .with("live-events-subscription-service", default_ttl: 5.minutes) .and_return({ "app-host" => "http://example.com", }) - allow(Canvas::DynamicSettings).to receive(:find) + allow(DynamicSettings).to receive(:find) .with("canvas") .and_return({ "signing-secret" => "astringthatisactually32byteslong", diff --git a/spec/lib/services/rich_content_spec.rb b/spec/lib/services/rich_content_spec.rb index 5119a2423b3..63939c43ea6 100644 --- a/spec/lib/services/rich_content_spec.rb +++ b/spec/lib/services/rich_content_spec.rb @@ -23,8 +23,8 @@ require_dependency "services/rich_content" module Services describe RichContent do before do - allow(Canvas::DynamicSettings).to receive(:find).with(any_args).and_call_original - allow(Canvas::DynamicSettings).to receive(:find) + allow(DynamicSettings).to receive(:find).with(any_args).and_call_original + allow(DynamicSettings).to receive(:find) .with("rich-content-service", default_ttl: 5.minutes) .and_return(DynamicSettings::FallbackProxy.new( "app-host" => "rce-app", diff --git a/spec/lti_1_3_spec_helper.rb b/spec/lti_1_3_spec_helper.rb index fa0ff68a782..8f41b8e130a 100644 --- a/spec/lti_1_3_spec_helper.rb +++ b/spec/lti_1_3_spec_helper.rb @@ -23,7 +23,7 @@ RSpec.shared_context "lti_1_3_spec_helper", shared_context: :metadata do include_context "lti_1_3_tool_configuration_spec_helper" let(:fallback_proxy) do - Canvas::DynamicSettings::FallbackProxy.new({ + DynamicSettings::FallbackProxy.new({ CanvasSecurity::KeyStorage::PAST => CanvasSecurity::KeyStorage.new_key, CanvasSecurity::KeyStorage::PRESENT => CanvasSecurity::KeyStorage.new_key, CanvasSecurity::KeyStorage::FUTURE => CanvasSecurity::KeyStorage.new_key @@ -33,6 +33,6 @@ RSpec.shared_context "lti_1_3_spec_helper", shared_context: :metadata do let(:developer_key) { DeveloperKey.create!(account: account) } before do - allow(Canvas::DynamicSettings).to receive(:kv_proxy).and_return(fallback_proxy) + allow(DynamicSettings).to receive(:kv_proxy).and_return(fallback_proxy) end end diff --git a/spec/models/auditors_spec.rb b/spec/models/auditors_spec.rb index acb771346d3..4014cf0bd2f 100644 --- a/spec/models/auditors_spec.rb +++ b/spec/models/auditors_spec.rb @@ -21,13 +21,13 @@ # for now leaving it here will confirm the Auditors/Audits shim is operating as expected. describe Auditors do after do - Canvas::DynamicSettings.config = nil - Canvas::DynamicSettings.reset_cache! - Canvas::DynamicSettings.fallback_data = nil + DynamicSettings.config = nil + DynamicSettings.reset_cache! + DynamicSettings.fallback_data = nil end def inject_auditors_settings(yaml_string) - Canvas::DynamicSettings.fallback_data = { + DynamicSettings.fallback_data = { private: { canvas: { "auditors.yml": yaml_string diff --git a/spec/models/canvadoc_spec.rb b/spec/models/canvadoc_spec.rb index fad90a1753c..e0eae4573bb 100644 --- a/spec/models/canvadoc_spec.rb +++ b/spec/models/canvadoc_spec.rb @@ -44,14 +44,14 @@ describe "Canvadoc" do describe "#jwt_secret" do it "returns the secret stored in DynamicSettings, base64 decoded" do - allow(Canvas::DynamicSettings).to receive(:find).with(service: "canvadoc", default_ttl: 5.minutes).and_return( + allow(DynamicSettings).to receive(:find).with(service: "canvadoc", default_ttl: 5.minutes).and_return( { "secret" => "c2Vrcml0" } ) expect(Canvadoc.jwt_secret).to eq "sekrit" end it "returns nil if no secret found in DynamicSettings" do - allow(Canvas::DynamicSettings).to receive(:find).with(service: "canvadoc", default_ttl: 5.minutes).and_return({}) + allow(DynamicSettings).to receive(:find).with(service: "canvadoc", default_ttl: 5.minutes).and_return({}) expect(Canvadoc.jwt_secret).to eq nil end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index f2ad3694a7d..5b4593358a7 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -456,7 +456,7 @@ RSpec.configure do |config| Folder.reset_path_lookups! Rails.logger.try(:info, "Running #{self.class.description} #{@method_name}") Attachment.current_root_account = nil - Canvas::DynamicSettings.reset_cache! + DynamicSettings.reset_cache! ActiveRecord::Migration.verbose = false RequestStore.clear! MultiCache.reset @@ -704,11 +704,11 @@ RSpec.configure do |config| end def override_dynamic_settings(data) - original_fallback = Canvas::DynamicSettings.fallback_data - Canvas::DynamicSettings.fallback_data = data + original_fallback = DynamicSettings.fallback_data + DynamicSettings.fallback_data = data yield ensure - Canvas::DynamicSettings.fallback_data = original_fallback + DynamicSettings.fallback_data = original_fallback end def json_parse(json_string = response.body)