3.0.1 • Published 5 years ago

uki-egg-acm v3.0.1

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

uki-egg-acm

NPM version build status Test coverage David deps Known Vulnerabilities npm download

Application Configuration Management (ACM), formerly known as Taobao's internal configuration center Diamond, is an application configuration center that enables you to centralize the management of application configurations, and accomplish real-time configuration push in a distributed environment. With ACM, you can greatly reduce the workload of configuration management and enhance service capabilities in scenarios such as microservices, DevOps, and big data.

Install

$ npm i uki-egg-acm --save

Usage

// {app_root}/config/plugin.js
exports.acm = {
  enable: true,
  package: 'uki-egg-acm',
};

Configuration

// {app_root}/config/config.default.js
exports.acm = {
  endpoint: 'acm.aliyun.com', // Available in the ACM console
  namespace: '**********',    // Available in the ACM console
  accessKey: '**********',    // Available in the ACM console
  secretKey: '**********',    // Available in the ACM console
  requestTimeout: 6000,       // Request timeout, 6s by default
};

see config/config.default.js for more detail.

Example

you can access acm-client api via app.acm or ctx.acm

// get config
const content= await app.acm.getConfig('test', 'DEFAULT_GROUP');
console.log('getConfig = ',content);

// subscription
app.acm.subscribe({
  dataId: 'test',
  group: 'DEFAULT_GROUP',
}, content => {
  console.log(content);
});

// publish config
const content= await app.acm.publishSingle('test', 'DEFAULT_GROUP', '测试');
console.log('getConfig = ',content);

// delete config
await acm.remove('test', 'DEFAULT_GROUP');

Questions & Suggestions

Please open an issue here.

License

MIT

3.0.1

5 years ago

3.0.0

5 years ago