diff --git a/README.md b/README.md index 0edd76c..9311302 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,6 @@ ali-ons [![NPM version][npm-image]][npm-url] [![build status][travis-image]][travis-url] [![David deps][david-image]][david-url] -[![node version][node-image]][node-url] [npm-image]: https://img.shields.io/npm/v/ali-ons.svg?style=flat-square [npm-url]: https://npmjs.org/package/ali-ons @@ -12,8 +11,6 @@ ali-ons [travis-url]: https://travis-ci.org/ali-sdk/ali-ons [david-image]: https://img.shields.io/david/ali-sdk/ali-ons.svg?style=flat-square [david-url]: https://david-dm.org/ali-sdk/ali-ons -[node-image]: https://img.shields.io/badge/node.js-%3E=_4.2.3-green.svg?style=flat-square -[node-url]: http://nodejs.org/download/ Aliyun Open Notification Service Client (base on opensource project [RocketMQ](https://github.com/alibaba/RocketMQ/tree/master/rocketmq-client)) @@ -36,8 +33,8 @@ const httpclient = require('urllib'); const Consumer = require('ali-ons').Consumer; const consumer = new Consumer({ httpclient, - accessKey: 'your-accesskey', - secretKey: 'your-secretkey', + accessKeyID: 'your-AccessKeyID', + accessKeySecret: 'your-AccessKeySecret', consumerGroup: 'your-consumer-group', // isBroadcast: true, }); @@ -60,8 +57,8 @@ const Message = require('ali-ons').Message; const producer = new Producer({ httpclient, - accessKey: 'your-accesskey', - secretKey: 'your-secretkey', + accessKeyID: 'your-AccessKeyID', + accessKeySecret: 'your-AccessKeySecret', producerGroup: 'your-producer-group', }); diff --git a/example/config.js b/example/config.js index 3e8bb69..03a9d30 100644 --- a/example/config.js +++ b/example/config.js @@ -9,8 +9,8 @@ const env = process.env; // export ALI_SDK_ONS_TOPIC=your-topic module.exports = { - accessKey: env.ALI_SDK_ONS_ID, - secretKey: env.ALI_SDK_ONS_SECRET, + accessKeyID: env.ALI_SDK_ONS_ID, + accessKeySecret: env.ALI_SDK_ONS_SECRET, producerGroup: env.ALI_SDK_ONS_PGROUP, consumerGroup: env.ALI_SDK_ONS_CGROUP, topic: env.ALI_SDK_ONS_TOPIC, diff --git a/lib/channel.js b/lib/channel.js index e428105..55d4fce 100644 --- a/lib/channel.js +++ b/lib/channel.js @@ -19,6 +19,9 @@ class Channel extends Base { constructor(address, options) { // 10.18.214.201:8080 const arr = address.split(':'); + // support alias: accessKeyID and accessKeySecret + options.accessKey = options.accessKey || options.accessKeyID; + options.secretKey = options.secretKey || options.accessKeySecret; super(Object.assign({ host: arr[0], port: arr[1], diff --git a/package.json b/package.json index 2f8a922..ee35a2c 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "ali-ons", "version": "3.1.0", "description": "Aliyun Open Notification Service Client", - "main": "./lib/index.js", + "main": "lib/index.js", "files": [ "lib" ],