Snippets

Popina Sync Gateway Config File 104.197.104.0

Created by Thomas Hebert last modified
{
 "interface":":4984",
 "adminInterface":":4985",
 "log": ["*"],
   "databases": {
    "database": {
     "server":"http://104.197.104.0: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);
}
`
   }
 }
}

Comments (0)

HTTPS SSH

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