switch LiveEvents config to use a single Consul key

makes it much easier to do a failsafe local cache on it

refs AE-380

Change-Id: Ia4bda742e3ee3f80749f3f074e2411b68476b49c
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/322309
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Isaac Moore <isaac.moore@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
Build-Review: Cody Cutrer <cody@instructure.com>
This commit is contained in:
Cody Cutrer 2023-07-07 15:09:11 -06:00
parent 014b010c05
commit f8f579cd82
5 changed files with 7 additions and 7 deletions

View File

@ -31,7 +31,7 @@ development:
application_id: "27627d1e-8a4f-4645-b390-bb396fc83c81"
client_token: "a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r"
sample_rate_percentage: 0.0 # Between 0.0 and 100.0; 0.0 disables the feature.
live-events:
live_events.yml: |-
aws_endpoint: http://kinesis.canvaslms.docker
kinesis_stream_name: live-events
aws_access_key_id: key

View File

@ -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 = -> { DynamicSettings.find("live-events", default_ttl: 2.hours) }
LiveEvents.settings = -> { YAML.safe_load(DynamicSettings.find(tree: :private, default_ttl: 2.hours)["live_events.yml", failsafe_cache: Rails.root.join("config")] || "{}") }
LiveEvents.aws_credentials = lambda do |settings|
if settings["vault_credential_path"]
Canvas::Vault::AwsCredentialProvider.new(settings["vault_credential_path"])
@ -44,7 +44,7 @@ Rails.configuration.to_prepare do
nil
end
end
LiveEvents.stream_client = ->(settings) { StubbedClient if settings["stub_kinesis"] }
LiveEvents.stream_client = ->(settings) { StubbedClient if settings["stub_kinesis"] }
# sometimes this async worker thread grabs a connection on a Setting read or similar.
# We need it to be released or the main thread can have a real problem.
LiveEvents.on_work_unit_end = -> { ActiveRecord::Base.clear_active_connections! }

View File

@ -32,7 +32,7 @@ should already see a live_events block and it should already be configured prope
If you don't see a live_events block, check the example file or copy this block:
```yml
live-events:
live_events.yml: |-
aws_endpoint: http://kinesis:4567
kinesis_stream_name: live-events
aws_access_key_id: key
@ -85,7 +85,7 @@ Note that these settings differ from the example block above. If you don't see a
block, check the example file or copy this block:
```yml
live-events:
live_events.yml: |-
aws_endpoint: http://kinesis.live-events-publish.docker
kinesis_stream_name: live-events-local-test-stream
aws_access_key_id: ACCESS_KEY

View File

@ -36,7 +36,7 @@
# live-events-subscription-service:
# app-host: http://les.docker
# sad-panda: null
# live-events:
# live_events.yml: |-
# aws_endpoint: http://kinesis.canvaslms.docker
# kinesis_stream_name: live-events
# aws_access_key_id: key

View File

@ -13,7 +13,7 @@ development:
address-book:
app-host: "http://address-book.docker"
secret: "opensesame"
live-events:
live_events.yml: |-
aws_endpoint: http://kinesis.canvaslms.docker
kinesis_stream_name: live-events
aws_access_key_id: key