Created
October 4, 2018 05:00
-
-
Save subhanahmed047/23a6c729e00d41697549d26e3671af17 to your computer and use it in GitHub Desktop.
Cloud Build Config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as Constants from './build-constants'; | |
const environments = { | |
production: Constants.PRODUCTION, | |
staging: Constants.STAGING, | |
dev: Constants.DEV, | |
dev2: Constants.DEV2, | |
}; | |
const currentEnvironment = environments.staging; | |
const getTitle = () => { | |
let title = ''; | |
switch (process.env.NODE_ENV) { | |
case 'production': | |
title = Constants.PRODUCTION_TITLE; | |
break; | |
case 'staging': | |
title = Constants.STAGING_TITLE; | |
break; | |
case 'development': | |
title = Constants.DEV_TITLE; | |
break; | |
case 'development2': | |
title = Constants.DEV2_TITLE; | |
break; | |
default: | |
title = Constants.PRODUCTION_TITLE; | |
break; | |
} | |
return title; | |
}; | |
const xmlString = `<?xml version="1.0" encoding="UTF-8"?> | |
<cartridge_basiclti_link xmlns="http://www.imsglobal.org/xsd/imslticc_v1p0" | |
xmlns:blti="http://www.imsglobal.org/xsd/imsbasiclti_v1p0" | |
xmlns:lticm="http://www.imsglobal.org/xsd/imslticm_v1p0" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://www.imsglobal.org/xsd/imslticc_v1p0 http://www.imsglobal.org/xsd/lti/ltiv1p0/imslticc_v1p0.xsd | |
http://www.imsglobal.org/xsd/imsbasiclti_v1p0 http://www.imsglobal.org/xsd/lti/ltiv1p0/imsbasiclti_v1p0.xsd"> | |
<blti:title>${getTitle()}</blti:title> | |
<blti:description>${getTitle()} Application</blti:description> | |
<blti:icon>https://inkerz.com/wp-content/uploads/2017/05/cropped-fav-icon1-32x32.png</blti:icon> | |
<blti:launch_url>https://${currentEnvironment}.inkerz.com/api/v1/lti/launch</blti:launch_url> | |
<blti:extensions platform="canvas.instructure.com"> | |
<lticm:property name="tool_id">${getTitle().toLowerCase().replace(/\s/g, '')}</lticm:property> | |
<lticm:property name="privacy_level">public</lticm:property> | |
<lticm:property name="domain">https://${currentEnvironment}.inkerz.com</lticm:property> | |
<lticm:options name="homework_submission"> | |
<lticm:property name="message_type">ContentItemSelectionRequest</lticm:property> | |
<lticm:property name="url">https://${currentEnvironment}.inkerz.com/api/v1/lti/launch?launchedFrom=homework_submission</lticm:property> | |
<lticm:property name="text">${getTitle()}</lticm:property> | |
<lticm:property name="selection_width">1100</lticm:property> | |
<lticm:property name="selection_height">600</lticm:property> | |
<lticm:property name="enabled">true</lticm:property> | |
</lticm:options> | |
<lticm:options name="editor_button"> | |
<lticm:property name="message_type">ContentItemSelectionRequest</lticm:property> | |
<lticm:property name="url">https://${currentEnvironment}.inkerz.com/api/v1/lti/launch?launchedFrom=editor_button</lticm:property> | |
<lticm:property name="text">${getTitle()}</lticm:property> | |
<lticm:property name="selection_width">1100</lticm:property> | |
<lticm:property name="selection_height">600</lticm:property> | |
<lticm:property name="enabled">true</lticm:property> | |
</lticm:options> | |
<lticm:options name="course_navigation"> | |
<lticm:property name="url">https://${currentEnvironment}.inkerz.com/api/v1/lti/launch?launchedFrom=course_navigation</lticm:property> | |
<lticm:property name="text">${getTitle()}</lticm:property> | |
<lticm:property name="visibility">public</lticm:property> | |
<lticm:property name="default">enabled</lticm:property> | |
<lticm:property name="selection_width">1100</lticm:property> | |
<lticm:property name="selection_height">600</lticm:property> | |
<lticm:property name="enabled">true</lticm:property> | |
</lticm:options> | |
<lticm:options name="assignment_selection"> | |
<lticm:property name="message_type">ContentItemSelectionRequest</lticm:property> | |
<lticm:property name="url">https://${currentEnvironment}.inkerz.com/api/v1/lti/launch?launchedFrom=assignment_selection</lticm:property> | |
<lticm:property name="text">${getTitle()}</lticm:property> | |
<lticm:property name="selection_width">1100</lticm:property> | |
<lticm:property name="selection_height">600</lticm:property> | |
</lticm:options> | |
</blti:extensions> | |
</cartridge_basiclti_link>`; | |
const parser = new DOMParser(); | |
const xmlDoc = parser.parseFromString(xmlString, 'text/xml'); | |
export default new XMLSerializer().serializeToString(xmlDoc); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment