rename Canvas::DynamicSettings => DynamicSettings
Change-Id: Ia2c1754ce729d95bcbf194f6b31a5a2b36d42bbb Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/282694 Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com> Reviewed-by: Charley Kline <ckline@instructure.com> QA-Review: Charley Kline <ckline@instructure.com> Product-Review: Charley Kline <ckline@instructure.com>
This commit is contained in:
parent
a555e4f6d7
commit
2f386d104a
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"]
|
||||
})
|
||||
|
|
|
@ -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
|
||||
})
|
||||
|
||||
|
|
|
@ -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?
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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' %>
|
||||
</div>
|
||||
<% if Canvas::DynamicSettings.find(tree: :private)['recaptcha_server_key'] %>
|
||||
<% if DynamicSettings.find(tree: :private)['recaptcha_server_key'] %>
|
||||
<div class="ic-Form-control">
|
||||
<%= 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)}" %>
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"])
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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\/\-=%]*)?
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -59,7 +59,7 @@ module MathMan
|
|||
end
|
||||
|
||||
def dynamic_settings
|
||||
Canvas::DynamicSettings.find("math-man")
|
||||
DynamicSettings.find("math-man")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 = {})
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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")
|
||||
})
|
||||
|
|
|
@ -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"
|
||||
})
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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")
|
||||
)
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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" })
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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"
|
||||
})
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue