Skip to content

Commit

Permalink
feat: unify aliyun keys to accessKeyID and accessKeySecret
Browse files Browse the repository at this point in the history
  • Loading branch information
fengmk2 committed Oct 17, 2018
1 parent eef0e01 commit 8ec58c8
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
11 changes: 4 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,13 @@ 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
[travis-image]: https://img.shields.io/travis/ali-sdk/ali-ons.svg?style=flat-square
[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))

Expand All @@ -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,
});
Expand All @@ -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',
});

Expand Down
4 changes: 2 additions & 2 deletions example/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 3 additions & 0 deletions lib/channel.js
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
],
Expand Down

0 comments on commit 8ec58c8

Please sign in to comment.