Skip to content

Instantly share code, notes, and snippets.

@Zodiase
Last active March 31, 2016 17:55
Show Gist options
  • Save Zodiase/d6240c6952232e29517178eb1910c2fb to your computer and use it in GitHub Desktop.
Save Zodiase/d6240c6952232e29517178eb1910c2fb to your computer and use it in GitHub Desktop.
Meteor `rootUrl` fix.
/**
* @license
* Copyright 2016 Xingchen Hong
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* This updates the `Meteor.absoluteUrl.defaultOptions.rootUrl` with the
* `rootUrl` in the settings so that `Meteor.absoluteUrl` works correctly in
* development mode.
*
* Should not cause any problems as long as `rootUrl` is set correctly.
*
* @author Xingchen Hong
* @version 1.0.0
* @see {@link https://gist.github.com/Zodiase/d6240c6952232e29517178eb1910c2fb} for updates.
*/
try {
check(Meteor.settings, Match.ObjectIncluding({
'public': Match.ObjectIncluding({
'rootUrl': String
})
}));
console.warn('Updating rootUrl from', Meteor.absoluteUrl.defaultOptions.rootUrl, 'to', Meteor.settings.public.rootUrl);
Meteor.absoluteUrl.defaultOptions.rootUrl = Meteor.settings.public.rootUrl;
} catch (e) {
// Do nothing.
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment