Skip to content

allow initialization for host:port and determine protocol automatically #14

New issue

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

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

Already on GitHub? # to your account

Closed
rabbah opened this issue Nov 19, 2016 · 1 comment
Closed
Assignees

Comments

@rabbah
Copy link
Member

rabbah commented Nov 19, 2016

rather than init the api like this:

var ow = openwhisk({api: 'https://openwhisk.ng.bluemix.net/api/v1/', api_key: '...', namespace: 'default_namespace'});

I'd like to suggest a little bit of convenience:

var ow = openwhisk({apihost: 'openwhisk.ng.bluemix.net', api_key: '...', namespace: 'default_namespace'});

where apihost allows one to just provide either the host or host:port.
this can be split to determine protocol as in

var edgeHostParts = apihost.split(':');
var protocol = (edgeHostParts.length >= 2  &&  edgeHostParts[1] == '443') ? 'https' : 'http';
api = protocol + '://' + apihost + '/api/v1/';
@jthomas
Copy link
Member

jthomas commented Nov 21, 2016

I've added this functionality as per the use case above.

AnthonyAmanse pushed a commit to AnthonyAmanse/incubator-openwhisk-client-js that referenced this issue Mar 27, 2019
Adjusted the project hierarchy.
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

2 participants