Skip to content
This repository was archived by the owner on Mar 10, 2020. It is now read-only.

autoconfigure in browser #51

Merged
merged 2 commits into from
Aug 27, 2015
Merged

autoconfigure in browser #51

merged 2 commits into from
Aug 27, 2015

Conversation

krl
Copy link
Contributor

@krl krl commented Aug 27, 2015

If host is unset, and we're in the browser, use the window.location.host to auto-configure the api.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@krl krl mentioned this pull request Aug 27, 2015
// autoconfigure in browser
if (!config.host &&
window && window.location) {
var split = window.location.host.split(':')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like it works when the ipfsAPI is used from a domain:port url only. Do we want to use the url of the web application where the domain is being loaded for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'gateway.ipfs.io'.split(':') -> ['gateway.ipfs.io']

@krl
Copy link
Contributor Author

krl commented Aug 27, 2015

Left out the port 80, tested localy and in gateway. if port is undefined, http.request defaults to local port.

@jbenet
Copy link
Contributor

jbenet commented Aug 27, 2015

@krl LGTM

jbenet added a commit that referenced this pull request Aug 27, 2015
@jbenet jbenet merged commit 0933354 into master Aug 27, 2015
@jbenet jbenet deleted the browser-autoconfigure branch August 27, 2015 16:03
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants