Hi,
I’ve update 3 files to try and point the app to my CB Server via SG. Nothing seems to work. I’ve also try just routing to SG (walrus), and that hasn’t worked. Below are the attempts I’ve made. Can anyone sort this out or is this sample app abandoned (I did notice a note from 3 months ago that sync-gateway-config.json was fixed)?
sync-gateway-config.json:
"log": ["HTTP", "Auth", "CRUD", "REST+", "Access"],
"facebook": { "register": true },
"databases": {
"todolite": {
"server": "https://data.******.com/",
"users": {
"GUEST": {"disabled": true}
},
"sync": `
function(doc, oldDoc) {
// NOTE this function is the same across the iOS, Android, and PhoneGap versions.
if (doc.type == "task") {
if (!doc.list_id) {
throw({forbidden : "Items must have a list_id."});
}
channel("list-"+doc.list_id);
} else if (doc.type == "list" || (doc._deleted && oldDoc && oldDoc.type == "list")) {
// Make sure that the owner propery exists:
var owner = oldDoc ? oldDoc.owner : doc.owner;
if (!owner) {
throw({forbidden : "List must have an owner."});
}
// Make sure that only the owner of the list can update the list:
if (doc.owner && owner != doc.owner) {
throw({forbidden : "Cannot change owner for lists."});
}
var ownerName = owner.substring(owner.indexOf(":")+1);
requireUser(ownerName);
var ch = "list-"+doc._id;
if (!doc._deleted) {
channel(ch);
}
// Grant owner access to the channel:
access(ownerName, ch);
// Grant shared members access to the channel:
var members = !doc._deleted ? doc.members : oldDoc.members;
if (Array.isArray(members)) {
var memberNames = [];
for (var i = members.length - 1; i >= 0; i--) {
memberNames.push(members[i].substring(members[i].indexOf(":")+1))
};
access(memberNames, ch);
}
} else if (doc.type == "profile") {
channel("profiles");
var user = doc._id.substring(doc._id.indexOf(":")+1);
if (user !== doc.user_id) {
throw({forbidden : "Profile user_id must match docid."});
}
requireUser(user);
access(user, "profiles");
}
}
`
}
}
}
And the top few lines of index.js is set:
fastclick = require("fastclick"),
appDbName = "todolite"
new fastclick.FastClick(document.body)
document.addEventListener("deviceready", onDeviceReady, false)
//var REMOTE_SYNC_URL = "http://localhost:4984/todolite"
//var REMOTE_SYNC_URL = "http://demo.mobile.couchbase.com/todolite"
var REMOTE_SYNC_URL = "https://data.*****.com.com/todolite"