From df616e5de45a5cb695534acd2155a63811d8b7e1 Mon Sep 17 00:00:00 2001 From: Ernst Widerberg Date: Fri, 15 Oct 2021 09:57:09 +0200 Subject: Use env var COLLECTOR_URL --- README.md | 6 ++++-- src/components/List.js | 2 +- src/components/ObjectView.js | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 112f8cd..b961dfe 100644 --- a/README.md +++ b/README.md @@ -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") } -- cgit v1.1