Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

absolute URL/Root URL with apollo app using meteor-now #53

Closed
acomito opened this issue May 7, 2017 · 2 comments
Closed

absolute URL/Root URL with apollo app using meteor-now #53

acomito opened this issue May 7, 2017 · 2 comments

Comments

@acomito
Copy link

acomito commented May 7, 2017

Apollo-Client needs to know the url endpoint to hit. When I dont have a custom domain, I've been setting arbitrary ROOT_URLs. Arbitrary URLs worked fine with meteor apps, but apollo uses the ROOT_URL to connect (or you can give it a uri) but in both cases I have no idea what the URL will be until after the app is deployed. Is there anyway around this without using a custom domain?

Maybe I can run a method on startup to grab this.connection uri and reset the environment variable ROOT_URL?

or maybe vanilla js: window.location.hostname on client

@purplecones
Copy link
Collaborator

purplecones commented May 7, 2017 via email

@jkrup
Copy link
Owner

jkrup commented May 7, 2017

Yeah #51 explains a possible workaround: you could do something to the effect of

Meteor.methods({
  setRootUrl: (pass, url) {
    if (pass === 'somelongsecretcode') {
      process.env.ROOT_URL = url;
    }
  },
});

Then you'll need to manually call Meteor.call('somelongsecretcode', ' http://iw0e8fh9asdhf.now.sh'), but that should work.

@jkrup jkrup closed this as completed May 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants