From 7ce3b8abd25fb2424e67b07d18d11d9676e1b2a5 Mon Sep 17 00:00:00 2001 From: Molly Struve Date: Tue, 13 Oct 2020 12:14:07 -0500 Subject: [PATCH] [deploy] Feature:Add Video States Encoder Key to SiteConfig (#10818) --- app/controllers/admin/configs_controller.rb | 1 + app/lib/constants/site_config.rb | 4 ++++ app/models/site_config.rb | 1 + app/views/admin/configs/show.html.erb | 8 ++++++++ spec/requests/admin/configs_spec.rb | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/app/controllers/admin/configs_controller.rb b/app/controllers/admin/configs_controller.rb index 468c93a01..f21970dcb 100644 --- a/app/controllers/admin/configs_controller.rb +++ b/app/controllers/admin/configs_controller.rb @@ -62,6 +62,7 @@ module Admin spam_trigger_terms recaptcha_site_key recaptcha_secret_key + video_encoder_key ] allowed_params = allowed_params | diff --git a/app/lib/constants/site_config.rb b/app/lib/constants/site_config.rb index 793b225cd..29cdc4d09 100644 --- a/app/lib/constants/site_config.rb +++ b/app/lib/constants/site_config.rb @@ -295,6 +295,10 @@ module Constants twitter_secret: { description: "The \"API secret key\" portion of consumer keys in the Twitter developer portal.", placeholder: "" + }, + video_encoder_key: { + description: "Secret key used to allow AWS video encoding through the VideoStatesController", + placeholder: "" } # Dynamic values ommitted: configurable_rate_limits and social_media_handles }.freeze diff --git a/app/models/site_config.rb b/app/models/site_config.rb index 0d3ce0b34..1b6efaf9e 100644 --- a/app/models/site_config.rb +++ b/app/models/site_config.rb @@ -19,6 +19,7 @@ class SiteConfig < RailsSettings::Base # API Tokens field :health_check_token, type: :string + field :video_encoder_key, type: :string # Authentication field :allow_email_password_registration, type: :boolean, default: false diff --git a/app/views/admin/configs/show.html.erb b/app/views/admin/configs/show.html.erb index f2535a9b2..6fe8988b1 100644 --- a/app/views/admin/configs/show.html.erb +++ b/app/views/admin/configs/show.html.erb @@ -104,6 +104,14 @@ placeholder: Constants::SiteConfig::DETAILS[:health_check_token][:placeholder] %>
<%= Constants::SiteConfig::DETAILS[:health_check_token][:description] %>
+
+ <%= admin_config_label :video_encoder_key %> + <%= f.text_field :video_encoder_key, + class: "form-control", + value: SiteConfig.video_encoder_key, + placeholder: Constants::SiteConfig::DETAILS[:video_encoder_key][:placeholder] %> +
<%= Constants::SiteConfig::DETAILS[:video_encoder_key][:description] %>
+
diff --git a/spec/requests/admin/configs_spec.rb b/spec/requests/admin/configs_spec.rb index 0e2942bd5..1aae46937 100644 --- a/spec/requests/admin/configs_spec.rb +++ b/spec/requests/admin/configs_spec.rb @@ -61,6 +61,12 @@ RSpec.describe "/admin/config", type: :request do confirmation: confirmation_message } expect(SiteConfig.health_check_token).to eq token end + + it "sets video_encoder_key" do + post "/admin/config", params: { site_config: { video_encoder_key: "123abc" }, + confirmation: confirmation_message } + expect(SiteConfig.video_encoder_key).to eq("123abc") + end end describe "Authentication" do