egg-eureka

1.0.2 • Public • Published

egg-eureka

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

Polling fetch Eureka registry and get instance info

This plugin runs on agent worker

and will send registry data to app worker when updated

then you could use ctx.app.getInstancesByAppId(appId) to get instances by certain appId

Install

$ npm i egg-eureka --save

Usage

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

Configuration

// {app_root}/config/config.default.js
exports.eureka = {
  instance: {
    hostName: 'egg-eureka-app.local',
    // secureVipAddress: '',  
    // vipAddress: '',
    homePageUrl: '/', // just path, will automatically join with ip and port or hostname if given
    statusPageUrl: '/info', // just path, will automatically join with ip and port or hostname if given
    healthCheckUrl: '/health' // just path, will automatically join with ip and port or hostname if given
  },
  registry: {
    server: 'http://localhost:32768/eureka/v2/apps/', // if use eureka cluster, then pass an (Array<url>, or String split by ',') eg: ['eureka1host/path','eureka2/path] or 'eureka1host/path, eureka2host/path'
    heartbeatInterval: 5000,
    registryFetchInterval: 1000,
    //... other config follow eureka-js-client https://github.com/jquatier/eureka-js-client#advanced-configuration-options
  }
}

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

Example

Questions & Suggestions

Please open an issue here.

License

MIT

/egg-eureka/

    Package Sidebar

    Install

    npm i egg-eureka

    Weekly Downloads

    3

    Version

    1.0.2

    License

    MIT

    Unpacked Size

    10.9 kB

    Total Files

    11

    Last publish

    Collaborators

    • zephyr419