add some config values
authorymh <ymh.work@gmail.com>
Mon, 19 Jun 2017 17:30:03 +0200
changeset 54 fad489be9c77
parent 53 d8588379529e
child 55 a2761c5be551
add some config values
.hgignore
client/.env
client/src/config.js
client/src/index.js
client/src/sagas/index.js
--- a/.hgignore	Mon Jun 19 17:56:41 2017 +0200
+++ b/.hgignore	Mon Jun 19 17:30:03 2017 +0200
@@ -33,3 +33,6 @@
 ^src/MANIFEST.in
 ^src/MANIFEST
 ^src/irinotes.egg-info/
+
+^design/Gemfile
+.ruby-version$
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/client/.env	Mon Jun 19 17:30:03 2017 +0200
@@ -0,0 +1,2 @@
+REACT_APP_API_ROOT_URL = http://localhost:8000
+REACT_APP_BASENAME =
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/client/src/config.js	Mon Jun 19 17:30:03 2017 +0200
@@ -0,0 +1,6 @@
+// define application configuration
+
+export default {
+  apiRootUrl: process.env.REACT_APP_API_ROOT_URL,
+  basename: process.env.REACT_APP_BASENAME
+}
--- a/client/src/index.js	Mon Jun 19 17:56:41 2017 +0200
+++ b/client/src/index.js	Mon Jun 19 17:30:03 2017 +0200
@@ -13,8 +13,11 @@
 import './index.css';
 import registerServiceWorker from './registerServiceWorker';
 import configureStore from './store/configureStore';
+import config from './config';
 
-const history = createHistory();
+const history = createHistory({
+    basename: config.basename
+});
 const store = configureStore(history);
 
 ReactDOM.render(
--- a/client/src/sagas/index.js	Mon Jun 19 17:56:41 2017 +0200
+++ b/client/src/sagas/index.js	Mon Jun 19 17:30:03 2017 +0200
@@ -4,6 +4,7 @@
 import PouchDBFind from 'pouchdb-find';
 import Immutable from 'immutable';
 import APIClient from '../APIClient';
+import config from '../config';
 
 PouchDB.debug.disable();
 PouchDB.plugin(PouchDBFind);
@@ -14,7 +15,7 @@
   index: { fields: ['session'] }
 });
 
-const client = new APIClient('http://localhost:8000')
+const client = new APIClient(config.apiRootUrl);
 
 // ---