diff --git a/Dockerfile b/Dockerfile index 65f29bf..49471ba 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,7 +20,7 @@ RUN addgroup -S -g $EGO_UI_GID $EGO_UI_USER \ # defaults ENV REACT_APP_EGO_CLIENT_ID=ego ENV REACT_APP_API=http://localhost:8081/ -ENV PUBLIC_URL="/" +ENV REACT_APP_PUBLIC_URL="/" USER $EGO_UI_UID diff --git a/public/index.html b/public/index.html index 21881b5..58f85b0 100644 --- a/public/index.html +++ b/public/index.html @@ -1,17 +1,16 @@ - + - - - - - - - - - - - Admin Portal - + + Admin Portal + - - -
- - - + diff --git a/src/App.tsx b/src/App.tsx index 4ec5bb0..8eb6cc3 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -12,6 +12,7 @@ import ResourceRoute from 'components/ResourceRoute'; import RESOURCE_MAP from 'common/RESOURCE_MAP'; import Nav from 'components/Nav'; import NoAccess from 'components/NoAccess'; +import { PUBLIC_URL } from 'common/injectGlobals'; const enhance = compose(provideLoggedInUser); @@ -22,7 +23,7 @@ const ProtectedRoute = injectState(({ component, state, ...rest }) => ( class App extends React.Component { render() { return ( - +
diff --git a/src/common/injectGlobals.ts b/src/common/injectGlobals.ts index 829f98d..c9575c3 100644 --- a/src/common/injectGlobals.ts +++ b/src/common/injectGlobals.ts @@ -11,6 +11,8 @@ export const API_ROOT = process.env.REACT_APP_API; export const EGO_CLIENT_ID = process.env.REACT_APP_EGO_CLIENT_ID; export const USE_DUMMY_DATA = process.env.REACT_APP_DUMMY; +export const PUBLIC_URL = process.env.REACT_APP_PUBLIC_URL; + export const STATUSES = ['DISABLED', 'APPROVED', 'PENDING', 'REJECTED']; export const DATE_KEYS = ['createdAt', 'lastLogin']; export const DATE_FORMAT = 'YYYY-MM-DD hh:mm A'; diff --git a/src/registerServiceWorker.ts b/src/registerServiceWorker.ts index 50a7a1d..f423939 100644 --- a/src/registerServiceWorker.ts +++ b/src/registerServiceWorker.ts @@ -20,7 +20,7 @@ const isLocalhost = Boolean( export default function register() { if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) { // The URL constructor is available in all browsers that support SW. - const publicUrl = new URL(process.env.PUBLIC_URL!, window.location.toString()); + const publicUrl = new URL(process.env.REACT_APP_PUBLIC_URL!, window.location.toString()); if (publicUrl.origin !== window.location.origin) { // Our service worker won't work if PUBLIC_URL is on a different origin // from what our page is served on. This might happen if a CDN is used to @@ -29,7 +29,7 @@ export default function register() { } window.addEventListener('load', () => { - const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`; + const swUrl = `${process.env.REACT_APP_PUBLIC_URL}/service-worker.js`; if (!isLocalhost) { // Is not local host. Just register service worker