nacos-egg

1.1.4 • Public • Published

nacos-egg

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

Install

$ npm i nacos-egg --save

Usage

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

Configuration

// {app_root}/config/config.default.js
exports.nacos = {
    register: {
      serverList: "127.0.0.1:8848", // Nacos 配置中心服务器地址
    },
    config: {
      dataId: "test",
      serverAddr: "127.0.0.1:8848",
      group: "DEFAULT_GROUP",
      namespace: "数据ID", // 配置的数据ID
    },
  };

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

Example

在应用中,你可以直接访问 app.config 来获取 NacosConfig 加载的配置。例如:

// {app_root}/config/plugin.js
// 从 NacosConfig 获取配置示例
const configValue = app.config.yourConfigKey; // 替换 yourConfigKey 为你的配置键名
console.log('配置值:', configValue);

Questions & Suggestions

Please open an issue here.

License

MIT

Package Sidebar

Install

npm i nacos-egg

Weekly Downloads

3

Version

1.1.4

License

MIT

Unpacked Size

7.69 kB

Total Files

5

Last publish

Collaborators

  • leizhuo