soca
soca copied to clipboard
vhost/rewrite support?
there doesn't seem to be a way to include rewrites through soca yet. is this correct?
Yes, not yet. Rewrites should be easy though since they're part of the DB - vhost's might be a little harder, but im willing to give it a shot.
ok awesome, I wasn't sure if I was missing something
for reference: python couchapp just has a root level rewrite.json that turns into the array of rewrites on your design doc.
for vhosts you would require server admin credentials and use the _config api.... but that's easy enough to do manually that you wouldn't necessarily need tooling for it (unless you consider a more automated vhost config a big convenience win)
i got deeper into rewrites over the last few days...
http://github.com/maxogden/couchappspora/blob/master/rewrites.json
the rewrites at the bottom are the key for vhosts... since it tricks $.couch into thinking you're at the root of a couchdb instance
http://wiki.couchapp.org/page/faq has some info under the 'How do I use $.couch.app() behind a vhost?' section
Rewrite rules can now be added in the rewrites.js file.
http://github.com/quirkey/soca/commit/9cbb2a545dd2473df89708edd8425d094cc27eba http://github.com/quirkey/soca/commit/925472b2d737c2357e237ace8286e139884a64d4
I think about renaming the file into rewrites.json (couchapp uses the same filename) but config.js has also .js and not .json extension.
I thought about how to store the vhost setting: putting it into config.js vs creating a soca command. Any thoughts on this?
ooh awesome.
keeping it in config.js makes sense, as you need admin rights in order to interact with the config api
I know, this is awesome. Thanks @rmetzler!
I'm realizing that maybe it makes sense to add a config option for mapping JSON instead of just directories. That way you could get rid of the need for a special filename for rewrites and just make it in config.js:
{
"mapJSON": {
"rewrites.js": "rewrites"
},
....
}
Also re:vhosts - I think it makes sense to make it a seperate command, but also be part of the config/push process. Well have to split it by env like:
"vhosts": {
"default": null,
"production": "soca.quirkey.com"
}
What do you guys think?