diff --git a/Dockerfile b/Dockerfile index b5e5eb91a76f2a0263954e426b575f6b5b32711d..7c9bd9f950c437b328f4ba41a9ca59177da4a795 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,6 +6,9 @@ ENV BACKEND_URL=${BACKEND_URL} ARG DATASET_PREVIEW_URL ENV DATASET_PREVIEW_URL=${DATASET_PREVIEW_URL:-https://hbp-kg-dataset-previewer.apps.hbp.eu/v2} +ARG BS_REST_URL +ENV BS_REST_URL=${BS_REST_URL:-https://brainscapes.apps-dev.hbp.eu/v1_0} + ARG STRICT_LOCAL ENV STRICT_LOCAL=${STRICT_LOCAL:-false} diff --git a/README.md b/README.md index 8deba5e6a1d2e2bb2b9e38b325e75c2338bf8d69..cd293c3bff01b68474c9fa7389e4961a01e1914a 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,7 @@ As interactive atlas viewer uses [webpack define plugin](https://webpack.js.org/ | `VERSION` | printed in console on viewer startup | `GIT_HASH` \|\| unspecificed hash | v2.2.2 | | `PRODUCTION` | if the build is for production, toggles optimisations such as minification | `undefined` | true | | `BACKEND_URL` | backend that the viewer calls to fetch available template spaces, parcellations, plugins, datasets | `null` | https://interactive-viewer.apps.hbp.eu/ | +| `BS_REST_URL` | [brainscape-api](https://jugit.fz-juelich.de/v.marcenko/brainscapes-api) used to fetch different resources | https://brainscapes.apps-dev.hbp.eu/v1_0 | | `DATASET_PREVIEW_URL` | dataset preview url used by component <https://github.com/fzj-inm1-bda/kg-dataset-previewer>. Useful for diagnosing issues with dataset previews.| https://hbp-kg-dataset-previewer.apps.hbp.eu/datasetPreview | http://localhost:1234/datasetPreview | | `MATOMO_URL` | base url for matomo analytics | `null` | https://example.com/matomo/ | | `MATOMO_ID` | application id for matomo analytics | `null` | 6 | diff --git a/deploy/constants.js b/deploy/constants.js index 4ba65d5c2aa5bda63b2a87443aadfc1d2463a337..05090af3fd5829887b0616f45fbae6cef8082dc2 100644 --- a/deploy/constants.js +++ b/deploy/constants.js @@ -5,11 +5,17 @@ const PUBLIC_PATH = process.env.NODE_ENV === 'production' ? path.join(__dirname, 'public') : path.join(__dirname, '..', 'dist', 'aot') -const indexTemplate = fs.readFileSync( - path.join(PUBLIC_PATH, 'index.html'), - 'utf-8' -) +let indexTemplate +try { + indexTemplate = fs.readFileSync( + path.join(PUBLIC_PATH, 'index.html'), + 'utf-8' + ) + +} catch (e) { + console.error(`index.html cannot be read. maybe run 'npm run build-aot' at root dir first?`) +} module.exports = { indexTemplate } diff --git a/src/atlasComponents/regionalFeatures/bsFeatures/module.ts b/src/atlasComponents/regionalFeatures/bsFeatures/module.ts index 0d7d2d3de7ccdfeda8ddd0cc9917285345860e4c..f4f16b8fa2c84a6c607dd8e25506bb9812c9bd47 100644 --- a/src/atlasComponents/regionalFeatures/bsFeatures/module.ts +++ b/src/atlasComponents/regionalFeatures/bsFeatures/module.ts @@ -12,7 +12,7 @@ import { BsFeatureService } from "./service"; providers: [ { provide: BS_ENDPOINT, - useValue: `https://brainscapes.apps-dev.hbp.eu` + useValue: BS_REST_URL || `https://brainscapes.apps-dev.hbp.eu` }, BsFeatureService ], diff --git a/typings/index.d.ts b/typings/index.d.ts index 295f6b6846c87d1b3e7be1b46a8de83e8782459b..f61544924774ac285111e8c571eab5d4b659094a 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -14,6 +14,7 @@ declare var VERSION : string declare var PRODUCTION: boolean declare var BACKEND_URL: string declare var DATASET_PREVIEW_URL: string +declare var BS_REST_URL: string declare var MATOMO_URL: string declare var MATOMO_ID: string declare var STRICT_LOCAL: boolean diff --git a/webpack/webpack.staticassets.js b/webpack/webpack.staticassets.js index 2b23b8b46f6546c6bad8a1c148e0c135780ed1b6..3f311ed752e55edec1dc99c2fc65d3d9722f1a66 100644 --- a/webpack/webpack.staticassets.js +++ b/webpack/webpack.staticassets.js @@ -67,6 +67,7 @@ module.exports = { PRODUCTION: !!process.env.PRODUCTION, BACKEND_URL: (process.env.BACKEND_URL && JSON.stringify(process.env.BACKEND_URL)) || 'null', DATASET_PREVIEW_URL: JSON.stringify(process.env.DATASET_PREVIEW_URL || 'https://hbp-kg-dataset-previewer.apps.hbp.eu/v2'), + BS_REST_URL: JSON.stringify(process.env.BS_REST_URL || 'https://brainscapes.apps-dev.hbp.eu/v1_0'), SPATIAL_TRANSFORM_BACKEND: JSON.stringify(process.env.SPATIAL_TRANSFORM_BACKEND || 'https://hbp-spatial-backend.apps.hbp.eu'), MATOMO_URL: JSON.stringify(process.env.MATOMO_URL || null), MATOMO_ID: JSON.stringify(process.env.MATOMO_ID || null),