From 9d61f92b732c23899959fbaeb37e55a8abdc415e Mon Sep 17 00:00:00 2001 From: jyeros Date: Sun, 8 Oct 2023 18:33:21 -0500 Subject: [PATCH 1/2] Allow specify api url --- .env.tpl | 2 ++ .gitignore | 1 + src/config.ts | 5 +++++ src/http/DoAnalyze.tsx | 4 ++-- 4 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 .env.tpl create mode 100644 src/config.ts diff --git a/.env.tpl b/.env.tpl new file mode 100644 index 0000000..715c058 --- /dev/null +++ b/.env.tpl @@ -0,0 +1,2 @@ +PORT=4000 +REACT_APP_API_URL=http://localhost:8081/ \ No newline at end of file diff --git a/.gitignore b/.gitignore index a02353a..ff72136 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ coverage node_modules .DS_Store build +.env diff --git a/src/config.ts b/src/config.ts new file mode 100644 index 0000000..92e24f1 --- /dev/null +++ b/src/config.ts @@ -0,0 +1,5 @@ +const config = { + apiUrl: process.env.REACT_APP_API_URL || 'http://localhost:8081/', +} + +export { config }; diff --git a/src/http/DoAnalyze.tsx b/src/http/DoAnalyze.tsx index de3fada..c7f8742 100644 --- a/src/http/DoAnalyze.tsx +++ b/src/http/DoAnalyze.tsx @@ -1,6 +1,7 @@ import ActionsRegister from "../state/ActionsRegister"; import * as React from "react"; import FetchMetadata from "./FetchMetadata"; +import { config } from "../config"; const DoAnalyze = { /** @@ -22,8 +23,7 @@ const DoAnalyze = { } }, async getProphetData(path: string) { - return await fetch( 'http://127.0.0.1:8081/', { - // return await fetch( 'https://cloudhubs.ecs.baylor.edu/prophet/utils', { + return await fetch(config.apiUrl , { method: 'POST', body: JSON.stringify({ repositories: [ From 6be4e646e4ed6f893bb4fc00624302072097b1b5 Mon Sep 17 00:00:00 2001 From: jyeros Date: Sun, 8 Oct 2023 18:33:46 -0500 Subject: [PATCH 2/2] Include msg mentioning branch is allowed --- src/components/configuration/ConfigForm.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/configuration/ConfigForm.tsx b/src/components/configuration/ConfigForm.tsx index edc91bb..fca6f09 100644 --- a/src/components/configuration/ConfigForm.tsx +++ b/src/components/configuration/ConfigForm.tsx @@ -35,7 +35,7 @@ const ConfigForm = (conf: ConfigProps) => {