Skip to content
Snippets Groups Projects
Unverified Commit 5e7830b8 authored by Khemissi Amir's avatar Khemissi Amir Committed by GitHub
Browse files

V2 resources migration: Removed the use of `Rails.configuration` in tasks. (#4048)

parent d19c3d5a
No related branches found
No related tags found
No related merge requests found
......@@ -51,10 +51,6 @@ module Greenlight
# The default callback url that bn launcher will redirect to
config.gl_callback_url = ENV["GL_CALLBACK_URL"]
# Greenlight V3 variables:
config.v3_endpoint = ENV["V3_ENDPOINT"]
config.v3_secret_key_base = ENV["V3_SECRET_KEY_BASE"]
# Default credentials (test-install.blindsidenetworks.com/bigbluebutton).
config.bigbluebutton_endpoint_default = "http://test-install.blindsidenetworks.com/bigbluebutton/api/"
config.bigbluebutton_secret_default = "8cd8ef52e8e101574e400365b55e11a6"
......
......@@ -4,7 +4,7 @@ namespace :migrations do
DEFAULT_ROLES_MAP = { "admin" => "Administrator", "user" => "User" }.freeze
COMMON = {
headers: { "Content-Type" => "application/json" },
batch_size: 1000,
batch_size: 500,
}.freeze
desc "Migrates v2 resources to v3"
......@@ -116,25 +116,23 @@ namespace :migrations do
private
def encrypt_params(params)
unless Rails.configuration.v3_secret_key_base.present?
unless ENV["V3_SECRET_KEY_BASE"].present?
raise red 'Unable to migrate: No "V3_SECRET_KEY_BASE" provided, please check your .env file.'
end
unless Rails.configuration.v3_secret_key_base.size >= 32
unless ENV["V3_SECRET_KEY_BASE"].size >= 32
raise red 'Unable to migrate: Provided "V3_SECRET_KEY_BASE" must be at least 32 charchters in length.'
end
key = Rails.configuration.v3_secret_key_base[0..31]
key = ENV["V3_SECRET_KEY_BASE"][0..31]
crypt = ActiveSupport::MessageEncryptor.new(key, cipher: 'aes-256-gcm', serializer: Marshal)
crypt.encrypt_and_sign(params, expires_in: 10.seconds)
end
def uri(path)
unless Rails.configuration.v3_endpoint.present?
raise red 'Unable to migrate: No "V3_ENDPOINT" provided, please check your .env file.'
end
raise red 'Unable to migrate: No "V3_ENDPOINT" provided, please check your .env file.' unless ENV["V3_ENDPOINT"].present?
res = URI(Rails.configuration.v3_endpoint)
res = URI(ENV["V3_ENDPOINT"])
res.path = "/api/v1/migrations/#{path}.json"
res
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment