-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
89 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
## Added | ||
|
||
- Added `<ErrorMessage>` component | ||
- Dynamic base name | ||
|
||
### Updated | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
# Only update config with defined env variables if we"re running an nginx process so we can still attach with debugging commands | ||
# without accidentally modifying anything | ||
if [ "$1" == "nginx" ]; then | ||
if [ ! -z "${REACT_APP_API_BASE_URL}" ]; then | ||
sed -i "/ENV_API_BASE_URL/c\var ENV_API_BASE_URL = \"${REACT_APP_API_BASE_URL}\";" /etc/nginx/html/config.js | ||
fi | ||
|
||
if [ ! -z "${REACT_APP_BASE_NAME}" ]; then | ||
sed -i "/ENV_BASE_NAME/c\var ENV_BASE_NAME = \"${REACT_APP_BASE_NAME}\";" /etc/nginx/html/config.js | ||
sed -i "s#REACT_APP_BASE_NAME#$REACT_APP_BASE_NAME#g" /etc/nginx/conf.d/default.conf | sed "s#//#/#g" | ||
sed -i "s#<base href=\"/\">#<base href=\"$REACT_APP_BASE_NAME/\">#g" /etc/nginx/html/index.html | sed "s#<base href=\"//\">#<base href=\"/\">#g" | ||
fi | ||
fi | ||
|
||
exec "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
var ENV_API_BASE_URL = ""; | ||
var ENV_BASE_NAME = ""; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
import { createBrowserHistory } from "history"; | ||
import { BASE_NAME } from "../../config"; | ||
|
||
export const history = createBrowserHistory({ basename: process.env.REACT_APP_BASE_NAME || "/" }); | ||
export const history = createBrowserHistory({ basename: BASE_NAME || "/" }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,14 @@ | ||
import * as _ from "lodash"; | ||
|
||
// Application specific configuration variables | ||
// potentially sourced from process.env.REACT_APP_* | ||
export const API_BASE_URL = process.env.REACT_APP_API_BASE_URL as string; | ||
|
||
// Variables defined in `public/config.js`, created from environment variables via `docker-entrypoint.sh` script on Docker container start | ||
// Will override "env" variables defined at runtime if set | ||
declare const ENV_API_BASE_URL: string; | ||
declare const ENV_BASE_NAME: string; | ||
|
||
export const API_BASE_URL = ( | ||
_.isEmpty(ENV_API_BASE_URL) ? process.env.REACT_APP_API_BASE_URL : ENV_API_BASE_URL | ||
) as string; | ||
export const BASE_NAME = (_.isEmpty(ENV_BASE_NAME) ? process.env.REACT_APP_BASE_NAME : ENV_BASE_NAME) as string; |