diff options
| author | Ernst Widerberg <ernstwi@kth.se> | 2021-10-15 09:57:09 +0200 |
|---|---|---|
| committer | Ernst Widerberg <ernstwi@kth.se> | 2021-10-15 09:57:09 +0200 |
| commit | df616e5de45a5cb695534acd2155a63811d8b7e1 (patch) | |
| tree | 853d554378d2ceed9c80ec16ed15e431d218df34 | |
| parent | 74dd9947b584f10d0745193031b15e5a84e15db8 (diff) | |
Use env var COLLECTOR_URL
| -rw-r--r-- | README.md | 6 | ||||
| -rw-r--r-- | src/components/List.js | 2 | ||||
| -rw-r--r-- | src/components/ObjectView.js | 2 |
3 files changed, 6 insertions, 4 deletions
@@ -2,12 +2,14 @@ ## Development setup -Run `soc_collector` on port 8000. The commit pointed to by the `soc_collector` submodule is compatible with `main` in this repo. +Run `soc_collector` and set env var `COLLECTOR_URL`. + +The commit pointed to by the `soc_collector` submodule is compatible with `main` in this repo. Populate `soc_collector` with data from `example_data.json`: ``` -cat example_data.json | curl -s -u user3:pw3 --data-binary @- http://localhost:8000/sc/v0/add +cat example_data.json | curl -s -u user3:pw3 --data-binary @- ${COLLECTOR_URL}/sc/v0/add ``` Get dependencies and start the front end: diff --git a/src/components/List.js b/src/components/List.js index bc74020..b93f2ee 100644 --- a/src/components/List.js +++ b/src/components/List.js @@ -24,7 +24,7 @@ class List extends React.Component { // Fetch data from external source, update state getData() { - fetch("http://localhost:8000/sc/v0/get", { + fetch(`${process.env.COLLECTOR_URL}/sc/v0/get`, { headers: { Authorization: "Basic " + btoa("user1:pw1") } diff --git a/src/components/ObjectView.js b/src/components/ObjectView.js index fc761ad..08951c0 100644 --- a/src/components/ObjectView.js +++ b/src/components/ObjectView.js @@ -17,7 +17,7 @@ class ObjectView extends React.Component { } getData() { - fetch(`http://localhost:8000/sc/v0/get/${this.props.id}`, { + fetch(`${process.env.COLLECTOR_URL}/sc/v0/get/${this.props.id}`, { headers: { Authorization: "Basic " + btoa("user1:pw1") } |
