Snippets

Popina Sync Gateway Config File 104.197.104.0

Updated by Thomas Hebert

File snippet.txt Modified

  • Ignore whitespace
  • Hide word diff
  "log": ["*"],
    "databases": {
     "database": {
-     "server":"http://104.155.56.43:8091/",
+     "server":"http://104.197.104.0:8091/",
      "bucket":"default",
      "users": {
       "GUEST": {"disabled": false, "admin_channels": ["*"]}
Created by Thomas Hebert

File snippet.txt Added

  • Ignore whitespace
  • Hide word diff
+{
+ "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.