renamed APIHOST to API_HOST and APIKEY to API_KEY.
diff --git a/README.md b/README.md
index d3dd1b5..d14649f 100644
--- a/README.md
+++ b/README.md
@@ -25,7 +25,7 @@
- **ignore_certs**. Turns off server SSL/TLS certificate verification. This allows the client to be used against local deployments of OpenWhisk with a self-signed certificate. Defaults to false.
*Client constructor will read values for the `apihost`, `namespace` and `api_key` options from the environment if the following parameters are set. Explicit parameter values override these values.*
-- __OW_APIHOST, __OW_NAMESPACE and __OW_APIKEY.
+- __OW_API_HOST, __OW_NAMESPACE and __OW_API_KEY.
_All methods return a Promise resolved asynchronously with the results. Failures are available through the catch method._
diff --git a/lib/base_operation.js b/lib/base_operation.js
index c41609d..c16a899 100644
--- a/lib/base_operation.js
+++ b/lib/base_operation.js
@@ -11,12 +11,12 @@
}
parse_options (options) {
- const api_key = options.api_key || process.env['__OW_APIKEY']
+ const api_key = options.api_key || process.env['__OW_API_KEY']
const namespace = options.namespace || process.env['__OW_NAMESPACE']
const ignore_certs = options.ignore_certs
// if apihost is available, parse this into full API url
const api = options.api ||
- this.url_from_apihost(options.apihost || process.env['__OW_APIHOST'])
+ this.url_from_apihost(options.apihost || process.env['__OW_API_HOST'])
if (!api_key) {
throw new Error(`${messages.INVALID_OPTIONS_ERROR} Missing api_key parameter.`)
diff --git a/test/unit/base_operation.test.js b/test/unit/base_operation.test.js
index 205db1c..45d0fe7 100644
--- a/test/unit/base_operation.test.js
+++ b/test/unit/base_operation.test.js
@@ -52,28 +52,28 @@
})
test('should use environment parameters for options if not set explicitly.', t => {
- process.env['__OW_APIKEY'] = 'some_user:some_pass'
- process.env['__OW_APIHOST'] = 'mywhiskhost'
+ process.env['__OW_API_KEY'] = 'some_user:some_pass'
+ process.env['__OW_API_HOST'] = 'mywhiskhost'
process.env['__OW_NAMESPACE'] = 'user@host.com'
const base_operation = new BaseOperation()
- t.is(base_operation.options.api_key, process.env['__OW_APIKEY'])
+ t.is(base_operation.options.api_key, process.env['__OW_API_KEY'])
t.is(base_operation.options.api, 'https://mywhiskhost/api/v1/')
t.is(base_operation.options.namespace, process.env['__OW_NAMESPACE'])
- delete process.env['__OW_APIKEY']
- delete process.env['__OW_APIHOST']
+ delete process.env['__OW_API_KEY']
+ delete process.env['__OW_API_HOST']
delete process.env['__OW_NAMESPACE']
})
test('should use options for parameters even if environment parameters are available.', t => {
- process.env['__OW_APIKEY'] = 'some_user:some_pass'
- process.env['__OW_APIHOST'] = 'mywhiskhost'
+ process.env['__OW_API_KEY'] = 'some_user:some_pass'
+ process.env['__OW_API_HOST'] = 'mywhiskhost'
process.env['__OW_NAMESPACE'] = 'user@host.com'
const base_operation = new BaseOperation({apihost: 'openwhisk', api_key: 'mykey', namespace: 'mynamespace'})
t.is(base_operation.options.api_key, 'mykey')
t.is(base_operation.options.api, 'https://openwhisk/api/v1/')
t.is(base_operation.options.namespace, 'mynamespace')
- delete process.env['__OW_APIKEY']
- delete process.env['__OW_APIHOST']
+ delete process.env['__OW_API_KEY']
+ delete process.env['__OW_API_HOST']
delete process.env['__OW_NAMESPACE']
})