egg-acm

3.0.0 • Public • Published

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 egg-acm --save

Usage

// {app_root}/config/plugin.js
exports.acm = {
  enable: true,
  package: '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

Package Sidebar

Install

npm i egg-acm

Weekly Downloads

4

Version

3.0.0

License

MIT

Unpacked Size

11.2 kB

Total Files

10

Last publish

Collaborators

  • czy88840616
  • gxcsoccer
  • fengmk2
  • shuang6