Skip to content
Snippets Groups Projects
Commit 2bafcd69 authored by Xiao Gui's avatar Xiao Gui
Browse files

chore: use env var for bs api

parent 3c50c4ee
No related branches found
No related tags found
No related merge requests found
......@@ -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}
......
......@@ -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 |
......
......@@ -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
}
......@@ -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
],
......
......@@ -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
......
......@@ -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),
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment