sandstorm-io / meteor-spk

Tool for packaging Meteor apps for Sandstorm.io
Other
29 stars 17 forks source link

Make Meteor.absoluteUrl use X-Sandstorm-Base-Path #23

Open mitar opened 8 years ago

mitar commented 8 years ago

Meteor application boundled for Sandstorm should have Meteor.absoluteUrl changed so that X-Sandstorm-Base-Path is used for its root path.

mitar commented 8 years ago

I implemented it this way:

mitar commented 8 years ago

cc @mquandalle

mquandalle commented 8 years ago

The hack I initially written consisted in overwrite the Meteor.absoluteUrl to change its logic in a way that works on Sandstorm (here). Looking at the code again, it seems that a much easier way to have it work is to overwrite the client-side ROOT_URL variable that this function is using, instead of overwriting the function itself.

The value is defined here, and I guess the clean way would be either to set __meteor_runtime_config__.ROOT_URL or if we can’t to update Meteor.absoluteUrl.defaultOptions.rootUrl after client loading.