From e1b99b1b9674bf006eb70359db36dfb42f70bf95 Mon Sep 17 00:00:00 2001 From: Molly Struve Date: Sat, 30 May 2020 14:11:02 -0500 Subject: [PATCH] [deploy] Generate Random Health Check Tokens on App Setup (#8178) Co-authored-by: rhymes --- app/models/site_config.rb | 2 +- lib/tasks/{app_setup.rake => app_initializer.rake} | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) rename lib/tasks/{app_setup.rake => app_initializer.rake} (89%) diff --git a/app/models/site_config.rb b/app/models/site_config.rb index fb8642a01..c43462cac 100644 --- a/app/models/site_config.rb +++ b/app/models/site_config.rb @@ -12,7 +12,7 @@ class SiteConfig < RailsSettings::Base cache_prefix { "v1" } # API Tokens - field :health_check_token, type: :string, default: "secret" + field :health_check_token, type: :string # Authentication field :authentication_providers, type: :array, default: Authentication::Providers.available diff --git a/lib/tasks/app_setup.rake b/lib/tasks/app_initializer.rake similarity index 89% rename from lib/tasks/app_setup.rake rename to lib/tasks/app_initializer.rake index 55497b8af..35cfc366c 100644 --- a/lib/tasks/app_setup.rake +++ b/lib/tasks/app_initializer.rake @@ -14,5 +14,7 @@ namespace :app_initializer do puts "\n== Updating Data ==" Rake::Task["data_updates:enqueue_data_update_worker"].execute + + SiteConfig.health_check_token ||= SecureRandom.hex(10) end end