Pull info from node env var, not package.json

This commit is contained in:
dannyrb 2019-04-28 15:14:20 -04:00
parent 3447c80a6a
commit 66f587a5f9

View File

@ -1,38 +1,37 @@
import dicomParser from 'dicom-parser'; import dicomParser from 'dicom-parser'
import cornerstone from 'cornerstone-core'; import cornerstone from 'cornerstone-core'
import cornerstoneWADOImageLoader from 'cornerstone-wado-image-loader'; import cornerstoneWADOImageLoader from 'cornerstone-wado-image-loader'
import OHIF from 'ohif-core'; import OHIF from 'ohif-core'
import version from './version.js'; import version from './version.js'
import { homepage } from '../package.json';
window.info = { window.info = {
version, version,
homepage homepage: `${process.env.PUBLIC_URL}`,
}; }
// For debugging // For debugging
window.cornerstone = cornerstone; window.cornerstone = cornerstone
window.cornerstoneWADOImageLoader = cornerstoneWADOImageLoader; window.cornerstoneWADOImageLoader = cornerstoneWADOImageLoader
cornerstoneWADOImageLoader.external.cornerstone = cornerstone; cornerstoneWADOImageLoader.external.cornerstone = cornerstone
cornerstoneWADOImageLoader.external.dicomParser = dicomParser; cornerstoneWADOImageLoader.external.dicomParser = dicomParser
OHIF.user.getAccessToken = () => { OHIF.user.getAccessToken = () => {
// TODO: Get the Redux store from somewhere else // TODO: Get the Redux store from somewhere else
const state = window.store.getState(); const state = window.store.getState()
if (!state.oidc || !state.oidc.user) { if (!state.oidc || !state.oidc.user) {
return; return
} }
return state.oidc.user.access_token; return state.oidc.user.access_token
}; }
cornerstoneWADOImageLoader.configure({ cornerstoneWADOImageLoader.configure({
beforeSend: function(xhr) { beforeSend: function(xhr) {
const headers = OHIF.DICOMWeb.getAuthorizationHeader(); const headers = OHIF.DICOMWeb.getAuthorizationHeader()
if (headers.Authorization) { if (headers.Authorization) {
xhr.setRequestHeader('Authorization', headers.Authorization); xhr.setRequestHeader('Authorization', headers.Authorization)
} }
} },
}); })