Skip to content
Snippets Groups Projects
Commit 0427f99c authored by esikkala's avatar esikkala
Browse files

Add api url to config

parent 18a805c4
No related branches found
No related tags found
No related merge requests found
...@@ -26,9 +26,6 @@ Run client and server concurrently: ...@@ -26,9 +26,6 @@ Run client and server concurrently:
## Deploy with Docker ## Deploy with Docker
Note: the Docker container is meant to run on a server (NODE_ENV=production). If you want
to run it on localhost, the API url needs to be changed in `src/client/epics/index.js`.
### Build ### Build
`docker build -t mmm-web-app-c .` `docker build -t mmm-web-app-c .`
......
export const rootUrl = '';
export const publishedPort = 3006;
export const MAPBOX_ACCESS_TOKEN = 'pk.eyJ1IjoiZWtrb25lbiIsImEiOiJjam5vampzZ28xd2dyM3BzNXR0Zzg4azl4In0.eozyF-bBaZbA3ibhvJlJpQ'; export const MAPBOX_ACCESS_TOKEN = 'pk.eyJ1IjoiZWtrb25lbiIsImEiOiJjam5vampzZ28xd2dyM3BzNXR0Zzg4azl4In0.eozyF-bBaZbA3ibhvJlJpQ';
...@@ -36,10 +36,16 @@ import { ...@@ -36,10 +36,16 @@ import {
updateFacetValuesConstrainSelf, updateFacetValuesConstrainSelf,
updateLocale updateLocale
} from '../actions'; } from '../actions';
import { rootUrl, publishedPort } from '../configs/config';
// set port if running on localhost with NODE_ENV = 'production'
const port = location.hostname === 'localhost' || location.hostname === '127.0.0.1'
? `:${publishedPort}`
: '';
export const apiUrl = (process.env.NODE_ENV === 'development') export const apiUrl = (process.env.NODE_ENV === 'development')
? 'http://localhost:3001/api/' ? `http://localhost:3001${rootUrl}/api/`
: `${location.protocol}//${location.hostname}/api/`; : `${location.protocol}//${location.hostname}${port}${rootUrl}/api/`;
const backendErrorText = `Cannot connect to the MMM Knowledge Base. Please try again later.`; const backendErrorText = `Cannot connect to the MMM Knowledge Base. Please try again later.`;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment