Snippets

Popina Sync Gateway Config File 104.197.104.0

You are viewing an old version of this snippet. View the current version.
Revised by Thomas Hebert f4e46b4
{
 "interface":":4984",
 "adminInterface":":4985",
 "log": ["*"],
   "databases": {
    "database": {
     "server":"http://104.155.56.43:8091/",
     "bucket":"default",
     "users": {
      "GUEST": {"disabled": false, "admin_channels": ["*"]}
      },
      "sync":`
      function (doc, oldDoc) {
     if (!doc.owner) throw({forbidden : "Documents must have a owner"});

     var webOnly = [];
     var webChannelForOwner = 'webFor_' + doc.owner;
     var mobileChannelForOwner = 'mobileFor_' + doc.owner;

     // route channels
     if (webOnly.indexOf(doc.type) !== -1) channel(webChannelForOwner);
     else channel([mobileChannelForOwner, webChannelForOwner]);

     // give user access to channel
     access(doc.owner, webChannelForOwner);
     access(doc.owner, mobileChannelForOwner);
}
`
   }
 }
}
HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.