Skip to content

Commit d39221b

Browse files
committed
prev
1 parent ae9612f commit d39221b

File tree

4 files changed

+5
-17
lines changed

4 files changed

+5
-17
lines changed

frontend/.env.example

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
1-
REACT_APP_API_SCHEME=http
2-
REACT_APP_API_HOST=localhost
3-
REACT_APP_API_PORT=8080
1+
REACT_APP_API_URL=http://localhost:8080
42
REACT_APP_API_PATH=/api/v1

frontend/.env.production.template

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
1-
REACT_APP_API_SCHEME=REACT_APP_API_SCHEME_PLACEHOLDER
2-
REACT_APP_API_HOST=REACT_APP_API_HOST_PLACEHOLDER
3-
REACT_APP_API_PORT=REACT_APP_API_PORT_PLACEHOLDER
1+
REACT_APP_API_URL=REACT_APP_API_URL_PLACEHOLDER
42
REACT_APP_API_PATH=REACT_APP_API_PATH_PLACEHOLDER

frontend/scripts/replace-envvars.sh

+1-3
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ set -eux -o pipefail
44

55
for file in /app/static/js/*.js;
66
do
7-
sed -i 's|REACT_APP_API_SCHEME_PLACEHOLDER|'${REACT_APP_API_SCHEME}'|g' $file
8-
sed -i 's|REACT_APP_API_HOST_PLACEHOLDER|'${REACT_APP_API_HOST}'|g' $file
9-
sed -i 's|REACT_APP_API_PORT_PLACEHOLDER|'${REACT_APP_API_PORT}'|g' $file
7+
sed -i 's|REACT_APP_API_URL_PLACEHOLDER|'${REACT_APP_API_URL}'|g' $file
108
sed -i 's|REACT_APP_API_PATH_PLACEHOLDER|'${REACT_APP_API_PATH}'|g' $file
119
done

frontend/src/lib/api/request.ts

+2-8
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,13 @@
11
import { getCookie } from "../cookie/cookie";
22

33
/** Scheme for all API requests. */
4-
export const API_SCHEME = process.env.REACT_APP_API_SCHEME;
5-
6-
/** The host for the API server. */
7-
export const API_HOST = process.env.REACT_APP_API_HOST;
8-
9-
/** The port for the API server. */
10-
export const API_PORT = process.env.REACT_APP_API_PORT;
4+
export const API_URL = process.env.REACT_APP_API_URL;
115

126
/** The base path for all API requests. */
137
export const API_PATH = process.env.REACT_APP_API_PATH;
148

159
/** The base url for all API requests. */
16-
export const API_BASE_URL = `${API_SCHEME}://${API_HOST}:${API_PORT}${API_PATH}`;
10+
export const API_BASE_URL = `${API_URL}${API_PATH}`;
1711

1812
/**
1913
* Makes an actual fetch request to the API, should be used by all other API implementations.

0 commit comments

Comments
 (0)