CollectionFS/Meteor-cfs-access-point — pull request #8 by DanielDornhardt (2014-08-31 23:24:59+00:00)
Title: Support meteor apps in a subdirectory on the server

Hello,

i created this patch to be able to run apps in a subdirectories of a domain.

Eg. if I want to have an app on

mydomain.com/beta ,

it's possible to tell meteor that via a the ROOT_URL environment variable like this:

ROOT_URL="http://mydomain.com/beta" mrt ,

but CollectionFS didn't take that into account until now and just didn't work, as far as I can see.

Meteor provides a runtime variable, __meteor_runtime_config__.ROOT_URL_PATH_PREFIX , which contains the /subdirectory/on/the/server in which the app is running, both on the client and the server.

We therefore can use this variable to prepend it to created URLs.

This then allows for multiple apps on different subdirectories.

Please have a look at the patch, see if it makes sense, if I forgot anything obvious and if there's anything I could do to make it more palatable.

I tested it for my own use and for the file and HTTP Upload backend only, so it'd of course be good to have this tested on different configurations as well.

Thanks for the great work everybody and best wishes!

PS: I've submitted a pull request to IronRouter too, if anyone needs to use that as well as collectionFS, check it out here: https://github.com/EventedMind/iron-router/pull/800 or here: https://github.com/DanielDornhardt/iron-router/tree/supportSubdirectoriesOnDomain (at least until it's merged)