From 1f8376ed8a0cd2a553c1c12a2517969553a6eb51 Mon Sep 17 00:00:00 2001 From: Phil Condreay Date: Thu, 30 Jun 2016 11:55:21 -0400 Subject: [PATCH 2/6] Add a newline at the end of .watchmanconfig. --- .watchmanconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.watchmanconfig b/.watchmanconfig index 9e26dfe..0967ef4 100644 --- a/.watchmanconfig +++ b/.watchmanconfig @@ -1 +1 @@ -{} \ No newline at end of file +{} -- GitLab From caddd06cf5db03faa2ab9970079f2d734d324df3 Mon Sep 17 00:00:00 2001 From: Jose Contreras Date: Mon, 11 Jul 2016 15:30:06 -0400 Subject: [PATCH 3/6] Change permissions on gradlew to make executable. --- android/gradlew | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 android/gradlew diff --git a/android/gradlew b/android/gradlew old mode 100644 new mode 100755 -- GitLab From be4d5d51829657f3f9cda0a02bf151d49d66b84f Mon Sep 17 00:00:00 2001 From: Jose Contreras Date: Wed, 13 Jul 2016 11:54:59 -0400 Subject: [PATCH 4/6] Create default config and use config. Modify configuration functions to use a port variable. --- app/stores/allStores.js | 7 ++++--- app/stores/dataStore.js | 4 ++-- app/utils/kefirCouchbase.js | 4 ++-- config/config.default.js | 12 ++++++++++++ 4 files changed, 20 insertions(+), 7 deletions(-) create mode 100644 config/config.default.js diff --git a/app/stores/allStores.js b/app/stores/allStores.js index 4e9faeb..e625235 100644 --- a/app/stores/allStores.js +++ b/app/stores/allStores.js @@ -3,10 +3,11 @@ import getNavStore from './navStore'; import getDataStore$ from './dataStore'; import Kefir from 'kefir'; import U from '../utils/utils'; +import config from '../../config/config'; export default (actions, routes, entities) => { const nav = getNavStore(actions.nav, routes); - const data = getDataStore$(actions.data, 5984, 'admin', 'password', 'http://localhost:5984/', 'blocpower'); + const data = getDataStore$(actions.data, config.cb_local_port, config.cb_local_user, config.cb_local_password, config.cb_local_host, config.cb_local_bucket); const load$ = data.map(db => { //This action is used for debugging actions.data.deleteDatabase.raw.flatMap(() => db.deleteDatabase()).onValue(U.popJson); @@ -17,7 +18,7 @@ export default (actions, routes, entities) => { nav: nav, db: db, changes: db.changes$, - //This stream contains a actions that can be applied to a map to keep the map in sync to the data in the datbase + //This stream contains a actions that can be applied to a map to keep the map in sync to the data in the database //The original object is included so it can be use to apply filters. change_actions: db.changes$ .flatten(e => e.results) @@ -32,7 +33,7 @@ export default (actions, routes, entities) => { // // store.change_actions.log('change-actions'); - store.replication = db.setupReplication('', '', 'http://couchbase1.sbdev.io:4984', 'blocpoweraudit' + (__DEV__ ? 'dev' : '')) + store.replication = db.setupReplication(config.cb_replication_user, config.cb_replication_password, config.cb_replication_host, config.cb_replication_port, config.cb_replication_bucket + (__DEV__ ? 'dev' : '')) // store.replication.onError(x => U.popMsg('Unexpected Error', 'Replication Error')); store.replication.onError(U.popJsonMap('Replication Error')); diff --git a/app/stores/dataStore.js b/app/stores/dataStore.js index cfa10f9..5237f5a 100644 --- a/app/stores/dataStore.js +++ b/app/stores/dataStore.js @@ -5,6 +5,6 @@ import mainDesignDoc from './mainDesignDoc'; export default (actions, port, username, password, url, bucketName) => { return kc.getListener$(port, username, password) - .flatMap(listener => listener.getDatabase(url, bucketName, { name: 'main', doc: mainDesignDoc})) + .flatMap(listener => listener.getDatabase(url+":"+port+"/", bucketName, { name: 'main', doc: mainDesignDoc})) .map(data => { data.cb.startListen(data.info); return data.cb; }); -} \ No newline at end of file +} diff --git a/app/utils/kefirCouchbase.js b/app/utils/kefirCouchbase.js index e1115b1..3bdf7f1 100644 --- a/app/utils/kefirCouchbase.js +++ b/app/utils/kefirCouchbase.js @@ -57,8 +57,8 @@ class KefirCouchbase { this.compact = () => { return Kefir.fromCallback( cb => database.makeRequest("POST", database.databaseUrl + database.databaseName + "/_compact", null, cb)); }; } - setupReplication(userId, password, remoteServerUrl , remoteBucketName) { - const remoteDbUrl = `${remoteServerUrl}/${remoteBucketName}`; + setupReplication(userId, password, remoteServerUrl , port ,remoteBucketName) { + const remoteDbUrl = `${remoteServerUrl}:${port}/${remoteBucketName}`; const sessionUrl = `${remoteDbUrl}/_session`; const self = this; diff --git a/config/config.default.js b/config/config.default.js new file mode 100644 index 0000000..9ce820f --- /dev/null +++ b/config/config.default.js @@ -0,0 +1,12 @@ +module.exports = { + cb_replication_host: "$REPLICATION_HOST", + cb_replication_port : $REPLICATION_PORT, + cb_replication_user : "$REPLICATION_USER", + cb_replication_password : "$REPLICATION_PASSWORD", + cb_replication_bucket : "$REPLICATION_BUCKET", + cb_local_host : "$LOCAL_HOST", + cb_local_port : $LOCAL_PORT, + cb_local_user : "$LOCAL_USER", + cb_local_password : "$LOCAL_PASSWORD", + cb_local_bucket : "$LOCAL_BUCKET" +}; -- GitLab From c2c9008edd3d2bd02d2d8b11a1adc54357d2a777 Mon Sep 17 00:00:00 2001 From: Jose Contreras Date: Wed, 13 Jul 2016 11:57:40 -0400 Subject: [PATCH 5/6] Add config to gitignore. --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index bf4bf6a..97fa005 100644 --- a/.gitignore +++ b/.gitignore @@ -44,3 +44,6 @@ test_card.sdcard export_server/local export_server/local/ + +#Configuration file +config/config.js -- GitLab From bbad01cd9152b21952b23e2a375b59108803c522 Mon Sep 17 00:00:00 2001 From: Jose Contreras Date: Thu, 28 Jul 2016 14:21:43 -0400 Subject: [PATCH 6/6] Remove adding dev to bucketname. --- app/stores/allStores.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/stores/allStores.js b/app/stores/allStores.js index e625235..8f8520a 100644 --- a/app/stores/allStores.js +++ b/app/stores/allStores.js @@ -33,7 +33,7 @@ export default (actions, routes, entities) => { // // store.change_actions.log('change-actions'); - store.replication = db.setupReplication(config.cb_replication_user, config.cb_replication_password, config.cb_replication_host, config.cb_replication_port, config.cb_replication_bucket + (__DEV__ ? 'dev' : '')) + store.replication = db.setupReplication(config.cb_replication_user, config.cb_replication_password, config.cb_replication_host, config.cb_replication_port, config.cb_replication_bucket) // store.replication.onError(x => U.popMsg('Unexpected Error', 'Replication Error')); store.replication.onError(U.popJsonMap('Replication Error')); -- GitLab