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

Consider looking up the public IP of the host system if no IP given #13

Closed
nexdrew opened this issue Jun 10, 2016 · 0 comments
Closed

Comments

@nexdrew
Copy link
Contributor

nexdrew commented Jun 10, 2016

Could use Sindre's public-ip module.

This would make the CLI much more convenient - just install and run which-cloud on the host!

Not quite sure how this would be best represented in the API - perhaps just accept a callback as the first-and-only argument? That would be nicer than forcing a module to pass a falsy IP value, but slightly complicates the implementation, particularly if it ever accepts separate opts too.

I could imagine all of these being valid:

// callback
whichCloud(ip, opts, cb)
whichCloud(null, opts, cb) // do ip lookup
whichCloud(ip, cb)
whichCloud(cb) // do ip lookup
// promise
whichCloud(ip, opts).then(c => {})
whichCloud(null, opts).then(c => {}) // do ip lookup
whichCloud(ip).then(c => {})
whichCloud().then(c => {}) // do ip lookup

But we could, of course, just use another function for the "do IP lookup" option:

// callback
whichCloud.lookup(opts, cb)
whichCloud.lookup(cb)
// promise
whichCloud.lookup(opts).then(c => {})
whichCloud.lookup().then(c => {})
@nexdrew nexdrew changed the title Consider looking up the public IP of the host system if not provided Consider looking up the public IP of the host system if no IP given Jun 10, 2016
@bcoe bcoe closed this as completed in #14 Jun 14, 2016
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

1 participant