Skip to content

Commit

Permalink
shadow password rewrites
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacs committed Mar 8, 2012
1 parent eafdc5f commit 740dffa
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions registry/shadow.js
@@ -0,0 +1,26 @@
module.exports =
{ _id:'_design/ghost'
, rewrites: ghostRewrites()
, language: "javascript"
}

function ghostRewrites () {
return require("./rewrites.js").map(function (rule) {

var to = rule.to
if (rule.to.match(/\/_users(?:\/|$)/)) {
if (rule.method === "GET") {
to = to.replace(/\/_users(\/|$)/, "/public_users$1")
}
} else {
to = "../app/" + to
}
to = to.replace(/\/\/+/g, '/')

return { from: rule.from
, method: rule.method
, query: rule.query
, to: to
}
})
}

0 comments on commit 740dffa

Please sign in to comment.