diff --git a/DEVNOTES.md b/DEVNOTES.md index 6e80a9024..5104c3bb1 100644 --- a/DEVNOTES.md +++ b/DEVNOTES.md @@ -12,10 +12,12 @@ nvm install 22.6.0 npm install ``` -3. Install configs for an environment. This example is for the `alpha` environment, but you can use values from any environment by looking at the deployed configs in https://duos-k8s.dsde-{%ENV%}.broadinstitute.org/config.json where {%ENV%} is any of `dev`, `staging`, `alpha`, or `prod` -Remember to set the `env` value appropriately. We use `local` for running via npm, but under docker, we use a real env like `dev`. -The installation steps outlined in this step can also be completed using the [render-configs.sh](scripts/render-configs.sh) script which can generate all required -files for local development. +3. Install configs for an environment. This example is for the `alpha` environment, but you can use values from any +environment by looking at the deployed configs in https://duos-k8s.dsde-{%ENV%}.broadinstitute.org/config.json where +{%ENV%} is any of `dev`, `staging`, `alpha`, or `prod`. Remember to set the `env` value appropriately, for example, +`dev`. Certain features are available only in specific environments. Setting the `env` value to the desired environment +will simulate it for local development. The installation steps outlined in this step can also be completed using the +[render-configs.sh](scripts/render-configs.sh) script which can generate all required files for local development. ``` cp config/alpha.json public/config.json ``` @@ -50,8 +52,9 @@ npm start ``` ### Running under Docker -Update your local `docker-compose.yaml` file to mount the preferred `config.json` file in app volumes. -Remember to set the `env` value appropriately in `config.json`. We use `local` for running via npm, but under docker, we use a real env like `dev` +Update your local `docker-compose.yaml` file to mount the preferred `config.json` file in app volumes. Remember to set +the `env` value appropriately, for example, `dev`. Certain features are available only in specific environments. Setting +the `env` value to the desired environment will simulate it for local development. ```yaml volumes: diff --git a/package-lock.json b/package-lock.json index 96a1509f6..95858a684 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,7 +20,6 @@ "ajv-formats": "3.0.1", "axios": "1.7.7", "dompurify": "3.1.6", - "http-proxy-middleware": "2.0.6", "js-file-download": "0.4.12", "lodash": "4.17.21", "mixin-deep": "2.0.1", @@ -4297,7 +4296,7 @@ "version": "1.19.2", "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.2.tgz", "integrity": "sha512-ALYone6pm6QmwZoAgeyNksccT9Q4AWZQ6PvfwR37GT6r6FWUPguq6sUmNGSMV2Wr761oQoBxwGGa6DR5o1DC9g==", - "devOptional": true, + "dev": true, "dependencies": { "@types/connect": "*", "@types/node": "*" @@ -4316,7 +4315,7 @@ "version": "3.4.35", "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.35.tgz", "integrity": "sha512-cdeYyv4KWoEgpBISTxWvqYsVy444DOqehiF3fM3ne10AmJ62RSyNkUnxMJXHQWRQQX2eR94m5y1IZyDwBjV9FQ==", - "devOptional": true, + "dev": true, "dependencies": { "@types/node": "*" } @@ -4368,7 +4367,7 @@ "version": "4.17.13", "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.13.tgz", "integrity": "sha512-6bSZTPaTIACxn48l50SR+axgrqm6qXFIxrdAKaG6PaJk3+zuUr35hBlgT7vOmJcum+OEaIBLtHV/qloEAFITeA==", - "devOptional": true, + "dev": true, "dependencies": { "@types/body-parser": "*", "@types/express-serve-static-core": "^4.17.18", @@ -4380,7 +4379,7 @@ "version": "4.17.30", "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.17.30.tgz", "integrity": "sha512-gstzbTWro2/nFed1WXtf+TtrpwxH7Ggs4RLYTLbeVgIkUQOI3WG/JKjgeOU1zXDvezllupjrf8OPIdvTbIaVOQ==", - "devOptional": true, + "dev": true, "dependencies": { "@types/node": "*", "@types/qs": "*", @@ -4424,6 +4423,7 @@ "version": "1.17.9", "resolved": "https://registry.npmjs.org/@types/http-proxy/-/http-proxy-1.17.9.tgz", "integrity": "sha512-QsbSjA/fSk7xB+UXlCT3wHBy5ai9wOcNDWwZAtud+jXhwOM3l+EYZh8Lng4+/6n8uar0J7xILzqftJdJ/Wdfkw==", + "dev": true, "dependencies": { "@types/node": "*" } @@ -4482,7 +4482,7 @@ "version": "3.0.1", "resolved": "https://registry.npmjs.org/@types/mime/-/mime-3.0.1.tgz", "integrity": "sha512-Y4XFY5VJAuw0FgAqPNd6NNoV44jbq9Bz2L7Rh/J6jLTiHBSBJa9fxqQIvkIld4GsoDOcCbvzOUAbLPsSKKg+uA==", - "devOptional": true + "dev": true }, "node_modules/@types/ms": { "version": "0.7.32", @@ -4523,13 +4523,13 @@ "version": "6.9.7", "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.7.tgz", "integrity": "sha512-FGa1F62FT09qcrueBA6qYTrJPVDzah9a+493+o2PCXsesWHIn27G98TsSMs3WPNbZIEj4+VJf6saSFpvD+3Zsw==", - "devOptional": true + "dev": true }, "node_modules/@types/range-parser": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.4.tgz", "integrity": "sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw==", - "devOptional": true + "dev": true }, "node_modules/@types/react": { "version": "18.3.6", @@ -4632,7 +4632,7 @@ "version": "1.15.0", "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.15.0.tgz", "integrity": "sha512-z5xyF6uh8CbjAu9760KDKsH2FcDxZ2tFCsA4HIMWE6IkiYMXfVoa+4f9KX+FN0ZLsaMw1WNG2ETLA6N+/YA+cg==", - "devOptional": true, + "dev": true, "dependencies": { "@types/mime": "*", "@types/node": "*" @@ -6665,6 +6665,7 @@ "version": "3.0.3", "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dev": true, "dependencies": { "fill-range": "^7.1.1" }, @@ -9779,7 +9780,8 @@ "node_modules/eventemitter3": { "version": "4.0.7", "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", - "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==" + "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==", + "dev": true }, "node_modules/events": { "version": "3.3.0", @@ -10202,6 +10204,7 @@ "version": "7.1.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dev": true, "dependencies": { "to-regex-range": "^5.0.1" }, @@ -11401,6 +11404,7 @@ "version": "1.18.1", "resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.18.1.tgz", "integrity": "sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ==", + "dev": true, "dependencies": { "eventemitter3": "^4.0.0", "follow-redirects": "^1.0.0", @@ -11428,6 +11432,7 @@ "version": "2.0.6", "resolved": "https://registry.npmjs.org/http-proxy-middleware/-/http-proxy-middleware-2.0.6.tgz", "integrity": "sha512-ya/UeJ6HVBYxrgYotAZo1KvPWlgB48kUJLDePFeneHsVujFaW5WNj2NgWCAE//B1Dl02BIfYlpNgBy8Kf8Rjmw==", + "dev": true, "dependencies": { "@types/http-proxy": "^1.17.8", "http-proxy": "^1.18.1", @@ -11451,6 +11456,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-3.0.0.tgz", "integrity": "sha512-gwsOE28k+23GP1B6vFl1oVh/WOzmawBrKwo5Ev6wMKzPkaXaCDIQKzLnvsA42DRlbVTWorkgTKIviAKCWkfUwA==", + "dev": true, "engines": { "node": ">=10" }, @@ -11840,6 +11846,7 @@ "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, "engines": { "node": ">=0.10.0" } @@ -11893,6 +11900,7 @@ "version": "4.0.3", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, "dependencies": { "is-extglob": "^2.1.1" }, @@ -11950,6 +11958,7 @@ "version": "7.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, "engines": { "node": ">=0.12.0" } @@ -15756,6 +15765,7 @@ "version": "4.0.8", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", + "dev": true, "license": "MIT", "dependencies": { "braces": "^3.0.3", @@ -16532,6 +16542,7 @@ "version": "2.3.1", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, "engines": { "node": ">=8.6" }, @@ -19178,7 +19189,8 @@ "node_modules/requires-port": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", - "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==" + "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==", + "dev": true }, "node_modules/resolve": { "version": "1.22.1", @@ -21048,6 +21060,7 @@ "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, "dependencies": { "is-number": "^7.0.0" }, @@ -25931,7 +25944,7 @@ "version": "1.19.2", "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.2.tgz", "integrity": "sha512-ALYone6pm6QmwZoAgeyNksccT9Q4AWZQ6PvfwR37GT6r6FWUPguq6sUmNGSMV2Wr761oQoBxwGGa6DR5o1DC9g==", - "devOptional": true, + "dev": true, "requires": { "@types/connect": "*", "@types/node": "*" @@ -25950,7 +25963,7 @@ "version": "3.4.35", "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.35.tgz", "integrity": "sha512-cdeYyv4KWoEgpBISTxWvqYsVy444DOqehiF3fM3ne10AmJ62RSyNkUnxMJXHQWRQQX2eR94m5y1IZyDwBjV9FQ==", - "devOptional": true, + "dev": true, "requires": { "@types/node": "*" } @@ -26002,7 +26015,7 @@ "version": "4.17.13", "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.13.tgz", "integrity": "sha512-6bSZTPaTIACxn48l50SR+axgrqm6qXFIxrdAKaG6PaJk3+zuUr35hBlgT7vOmJcum+OEaIBLtHV/qloEAFITeA==", - "devOptional": true, + "dev": true, "requires": { "@types/body-parser": "*", "@types/express-serve-static-core": "^4.17.18", @@ -26014,7 +26027,7 @@ "version": "4.17.30", "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.17.30.tgz", "integrity": "sha512-gstzbTWro2/nFed1WXtf+TtrpwxH7Ggs4RLYTLbeVgIkUQOI3WG/JKjgeOU1zXDvezllupjrf8OPIdvTbIaVOQ==", - "devOptional": true, + "dev": true, "requires": { "@types/node": "*", "@types/qs": "*", @@ -26057,6 +26070,7 @@ "version": "1.17.9", "resolved": "https://registry.npmjs.org/@types/http-proxy/-/http-proxy-1.17.9.tgz", "integrity": "sha512-QsbSjA/fSk7xB+UXlCT3wHBy5ai9wOcNDWwZAtud+jXhwOM3l+EYZh8Lng4+/6n8uar0J7xILzqftJdJ/Wdfkw==", + "dev": true, "requires": { "@types/node": "*" } @@ -26115,7 +26129,7 @@ "version": "3.0.1", "resolved": "https://registry.npmjs.org/@types/mime/-/mime-3.0.1.tgz", "integrity": "sha512-Y4XFY5VJAuw0FgAqPNd6NNoV44jbq9Bz2L7Rh/J6jLTiHBSBJa9fxqQIvkIld4GsoDOcCbvzOUAbLPsSKKg+uA==", - "devOptional": true + "dev": true }, "@types/ms": { "version": "0.7.32", @@ -26156,13 +26170,13 @@ "version": "6.9.7", "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.7.tgz", "integrity": "sha512-FGa1F62FT09qcrueBA6qYTrJPVDzah9a+493+o2PCXsesWHIn27G98TsSMs3WPNbZIEj4+VJf6saSFpvD+3Zsw==", - "devOptional": true + "dev": true }, "@types/range-parser": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.4.tgz", "integrity": "sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw==", - "devOptional": true + "dev": true }, "@types/react": { "version": "18.3.6", @@ -26269,7 +26283,7 @@ "version": "1.15.0", "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.15.0.tgz", "integrity": "sha512-z5xyF6uh8CbjAu9760KDKsH2FcDxZ2tFCsA4HIMWE6IkiYMXfVoa+4f9KX+FN0ZLsaMw1WNG2ETLA6N+/YA+cg==", - "devOptional": true, + "dev": true, "requires": { "@types/mime": "*", "@types/node": "*" @@ -27776,6 +27790,7 @@ "version": "3.0.3", "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dev": true, "requires": { "fill-range": "^7.1.1" } @@ -30056,7 +30071,8 @@ "eventemitter3": { "version": "4.0.7", "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", - "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==" + "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==", + "dev": true }, "events": { "version": "3.3.0", @@ -30392,6 +30408,7 @@ "version": "7.1.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dev": true, "requires": { "to-regex-range": "^5.0.1" } @@ -31273,6 +31290,7 @@ "version": "1.18.1", "resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.18.1.tgz", "integrity": "sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ==", + "dev": true, "requires": { "eventemitter3": "^4.0.0", "follow-redirects": "^1.0.0", @@ -31294,6 +31312,7 @@ "version": "2.0.6", "resolved": "https://registry.npmjs.org/http-proxy-middleware/-/http-proxy-middleware-2.0.6.tgz", "integrity": "sha512-ya/UeJ6HVBYxrgYotAZo1KvPWlgB48kUJLDePFeneHsVujFaW5WNj2NgWCAE//B1Dl02BIfYlpNgBy8Kf8Rjmw==", + "dev": true, "requires": { "@types/http-proxy": "^1.17.8", "http-proxy": "^1.18.1", @@ -31305,7 +31324,8 @@ "is-plain-obj": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-3.0.0.tgz", - "integrity": "sha512-gwsOE28k+23GP1B6vFl1oVh/WOzmawBrKwo5Ev6wMKzPkaXaCDIQKzLnvsA42DRlbVTWorkgTKIviAKCWkfUwA==" + "integrity": "sha512-gwsOE28k+23GP1B6vFl1oVh/WOzmawBrKwo5Ev6wMKzPkaXaCDIQKzLnvsA42DRlbVTWorkgTKIviAKCWkfUwA==", + "dev": true } } }, @@ -31562,7 +31582,8 @@ "is-extglob": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==" + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true }, "is-finalizationregistry": { "version": "1.0.2", @@ -31598,6 +31619,7 @@ "version": "4.0.3", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, "requires": { "is-extglob": "^2.1.1" } @@ -31633,7 +31655,8 @@ "is-number": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==" + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true }, "is-number-object": { "version": "1.0.7", @@ -34372,6 +34395,7 @@ "version": "4.0.8", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", + "dev": true, "requires": { "braces": "^3.0.3", "picomatch": "^2.3.1" @@ -34925,7 +34949,8 @@ "picomatch": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==" + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true }, "pify": { "version": "2.3.0", @@ -36704,7 +36729,8 @@ "requires-port": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", - "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==" + "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==", + "dev": true }, "resolve": { "version": "1.22.1", @@ -38130,6 +38156,7 @@ "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, "requires": { "is-number": "^7.0.0" } diff --git a/package.json b/package.json index da2eda293..196129565 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,6 @@ "ajv-formats": "3.0.1", "axios": "1.7.7", "dompurify": "3.1.6", - "http-proxy-middleware": "2.0.6", "js-file-download": "0.4.12", "lodash": "4.17.21", "mixin-deep": "2.0.1", diff --git a/src/libs/ajax.js b/src/libs/ajax.js index 3ee9f7bfa..a66d4ff16 100644 --- a/src/libs/ajax.js +++ b/src/libs/ajax.js @@ -30,18 +30,16 @@ axios.interceptors.response.use(function (response) { return Promise.reject(error); }); -export const getApiUrl = async(baseUrl = '') => { - const env = await Config.getEnv(); - return env === 'local' ? baseUrl : await Config.getApiUrl(); +export const getApiUrl = async() => { + return await Config.getApiUrl(); }; export const getBardApiUrl = async() => { return await Config.getBardApiUrl(); }; -export const getOntologyUrl = async(baseUrl = '') => { - const env = await Config.getEnv(); - return env === 'local' ? baseUrl : await Config.getOntologyApiUrl(); +export const getOntologyUrl = async() => { + return await Config.getOntologyApiUrl(); }; export const sleep = (ms) => { diff --git a/src/libs/ajax/ToS.js b/src/libs/ajax/ToS.js index a527bc9e5..c0dcce988 100644 --- a/src/libs/ajax/ToS.js +++ b/src/libs/ajax/ToS.js @@ -5,10 +5,7 @@ import { getApiUrl } from '../ajax'; export const ToS = { getDUOSText: async () => { - const env = await Config.getEnv(); - // When running locally, '/api' urls are rewritten in `setupProxy.js` so they're forwarded properly to the back end - const baseUrl = env === 'local' ? '/api' : ''; - const url = `${await getApiUrl(baseUrl)}/tos/text/duos`; + const url = `${await getApiUrl()}/tos/text/duos`; const res = await axios.get(url, Config.textPlain()); return res.data; }, diff --git a/src/pages/Status.jsx b/src/pages/Status.jsx index 7b1c9c1d9..0e19f6116 100644 --- a/src/pages/Status.jsx +++ b/src/pages/Status.jsx @@ -33,8 +33,8 @@ class Status extends Component { }; async componentDidMount() { - const consentStatusUrl = `${ await getApiUrl('/api') }/status`; - const ontologyStatusUrl = `${ await getOntologyUrl('/ontology') }/status`; + const consentStatusUrl = `${ await getApiUrl() }/status`; + const ontologyStatusUrl = `${ await getOntologyUrl() }/status`; fetch(consentStatusUrl, { method: 'GET' }) .then(response => response.json()) .then(data => this.setState({ consentStatus: data })); diff --git a/src/setupProxy.js b/src/setupProxy.js deleted file mode 100644 index df56a83dd..000000000 --- a/src/setupProxy.js +++ /dev/null @@ -1,55 +0,0 @@ -const { createProxyMiddleware } = require('http-proxy-middleware'); -const configUrls = require('../public/config.json'); - -/* - Rough outline of the proxy approach is described here - https://create-react-app.dev/docs/proxying-api-requests-in-development/#configuring-the-proxy-manually - - In short, this file is setting up proxy middleware that will listen for requests made to the application's open port. - It's the reason why the ajax file initializes a url string for our APIs depending on our environment. - If the config.json file has an env=local, then the url string will remove the host portion of the url, causing those requests to be self-referenced. - If the path matches any of the proxies, the request will be intercepted and altered based on its (proxy) configuration. - For most of the proxies, it means simply rewriting the urls so that the origin is or rather than hostname. - In the instance of status though, requests to ontology's and consent's status endpoints had their pathName changed. - The above needed to be done since, from an application perspective. '/status' is the request made to fetch assets (icons, html, etc.) for the status page. - Simply checking on '/status' would intercept the above request on page load, therefore consent's and ontology's status path needed to be different. - In addition, a pathRewrite option was defined to alter the pathName back to '/status' once the request is intercepted to ensure the endpoint is hit on those APIs. - - If you need to add additional paths to be intercepted, you can do one of two things - 1) If there exists a proxy that fits your needs, update the path listing for that proxy with the new value. - NOTE: multiple paths require an array argument instead of a string - 2) Append a new proxy by using app.use(). Format should be similar to the defined options below, but reference http-proxy-middleware docs if you need more - https://github.com/chimurai/http-proxy-middleware - NOTE: Middleware are executed in the order they are added. This may need to be taken into consideration if you want to add a proxy for a specific subpath. - - This file will only be read and evaluated when running 'react-scripts start' (which has been shortcuted to 'npm start' on package.json). - Our deployment processes use 'npm build' to generate bundled files that are served by nginx, with the files included having references in the application itself. - Since this file isn't imported or referenced by the application code in any way, it will not be included in the build files, therefore this file will not exist in - any deployed environments. -*/ - -module.exports = function (app) { - app.use( - ['/api', '/schemas', '/metrics'], - createProxyMiddleware({ - target: configUrls.apiUrl, - secure: false, - pathRewrite: { - '/api/status': '/status', - '/api/tos/text/duos': '/tos/text/duos' - } - }) - ); - - app.use( - ['/autocomplete', '/search', '/ontology/status', '/translate/paragraph'], - createProxyMiddleware({ - target: configUrls.ontologyApiUrl, - secure: false, - pathRewrite: { - '/ontology/status': '/status' - } - }) - ); - -};