I have finished the big cleanup of the user interface of the Go Runtime and I
prepared some examples.
One example was obviously how to use the OpenWhisk Client Go library (included
as a dependency using dep).
The library works without problems when I run an external test (because it
picks its parameters from ~/.wskprops) but fails when I run it in OpenWhisk. I
investigated and fond the library does NOT take its parameters from the
__OW_API_KEY, __OW_API_HOST and __OW_NAMESPACE as I would expect.
Furthermore there is not an obvious way to map those values in the
configuration. There is this
config := &whisk.Config{
Host: "openwhisk.ng.bluemix.net",
Version: "v1"
Namespace: "_",
AuthKey: "aaaaa-bbbbb-ccccc-ddddd-eeeee"
}
But for example, I miss the API version in the environment variables, I have to
split the "https://xxx:443" format of the API host to extract the Host. I can
submit a patch to fix that but we need agree how.
I think at that
- least the default constructor should check if those variables are available
before looking for a ~/wskprops.
- we should agree on a (future?) __OW_API_VERSION environment variables and if
it is missing assume a v1
- in the current _OW_API_HOST there is the port but I do not see it the port.
- There are some fields I do not understand:
type Config struct {
Namespace string
Cert string // what is this?
Key string
AuthToken string // what is the difference with key?
Host string
BaseURL *url.URL // Should I use Host or BaseURL? what is the
format?
Version string
Verbose bool
Debug bool
Insecure bool
UserAgent string
ApigwAccessToken string
AdditionalHeaders http.Header
}
--
Michele Sciabarra
[email protected]