add a setting for the common cartridge viewer url

closes ADMIN-2910
flag=direct_share

test plan:
- add a common_cartridge_viewer section to your
  config/dynamic_settings.yml file and set the base_url. See the example
  file for how to do this.
- As a teacher, go to the shared content page. In the console, check the
  value of ENV.COMMON_CARTRIDGE_VIEWER_URL. It should be the base_url
  value that you configured in dynamic_settings.yml

Change-Id: I61122519b18f33f3757cc0e1a401b630cf5aacb9
Reviewed-on: https://gerrit.instructure.com/210230
Tested-by: Jenkins
Reviewed-by: Mysti Lilla <mysti@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Reviewed-by: James Williams <jamesw@instructure.com>
QA-Review: Jon Willesen <jonw+gerrit@instructure.com>
Product-Review: Jon Willesen <jonw+gerrit@instructure.com>
This commit is contained in:
Jon Willesen 2019-09-19 11:05:16 -06:00 committed by Jon Willesen
parent 9a10036d36
commit 9d7bf53c29
3 changed files with 8 additions and 1 deletions

View File

@ -478,7 +478,10 @@ class ProfileController < ApplicationController
set_active_tab 'content_shares'
@context = @user.profile
js_env({})
ccv_settings = Canvas::DynamicSettings.find('common_cartridge_viewer') || {}
js_env({
COMMON_CARTRIDGE_VIEWER_URL: ccv_settings['base_url']
})
render :content_shares
end
end

View File

@ -25,6 +25,8 @@ development:
use_for_mml: 'false'
rich-content-service:
app-host: "rce.docker"
common_cartridge_viewer:
base_url: "http://localhost:3300"
# another service
inst-fs:
app-host: "http://api.instfs.docker"

View File

@ -229,9 +229,11 @@ describe ProfileController do
end
it "should show if user has any non-student enrollments" do
allow(Canvas::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')
expect(assigns.dig(:js_env, :COMMON_CARTRIDGE_VIEWER_URL)).to eq('the_ccv_url')
end
it "should 404 if user has only student enrollments" do