Skip to content
/ egg-acm Public

Aliyun ACM(Application Configuration Management) plugin for Egg.js

License

Notifications You must be signed in to change notification settings

eggjs/egg-acm

Repository files navigation

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

About

Aliyun ACM(Application Configuration Management) plugin for Egg.js

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published