Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(consul): consul's implementation was refactored #3109

Merged
merged 3 commits into from
Aug 13, 2023

Conversation

flyingcrp
Copy link
Contributor

Checklist
  • npm test passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)

@midwayjs/consul

Description of change

This PR mainly upgrades the implementation of @midwayjs/consul from object injection to a standalone service. The specific changes are as follows:

  • Refactors the dependency on lifecycle and global object registration to a singleton service implementation, using @init and @destroy instead of application lifecycle.
  • Refactors the configuration structure to follow the type and structure of the package, reducing the cognitive burden on users.
  • Removes the functionality to retrieve non-healthy status services.

BREAK CHANGE :

The configuration file has changed. Procedure:

old ⬇️

  consul1: {
    provider: {
      register: true,
      deregister: true,
      host: '',
      port: '8500',
      strategy: '',
      defaults: {
        token: '',
      },
    },
    service: {
      address: '',
      port: 7001,
      name: '',
      token: '',
      check: {
        http: '',
        interval: '5s',
      },
    },
  },

new ⬇️

consul: {
    deregister: true,
    register: {
      name: '',
      address: '',
      port: 7001,
    },
    options: {
      host: '',
      port: '8500',
      defaults: {
        token: '',
      },
    },
  }

@flyingcrp flyingcrp closed this Jul 27, 2023
@flyingcrp flyingcrp reopened this Jul 27, 2023
@codecov-commenter
Copy link

codecov-commenter commented Jul 27, 2023

Codecov Report

Patch coverage: 85.07% and project coverage change: -0.22% ⚠️

Comparison is base (2d93592) 81.78% compared to head (a9b5c1d) 81.56%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3109      +/-   ##
==========================================
- Coverage   81.78%   81.56%   -0.22%     
==========================================
  Files         437      435       -2     
  Lines       15918    15889      -29     
  Branches     3769     3761       -8     
==========================================
- Hits        13018    12960      -58     
- Misses       2631     2655      +24     
- Partials      269      274       +5     
Files Changed Coverage Δ
packages/consul/src/config/config.default.ts 100.00% <ø> (ø)
packages/consul/src/consul.service.ts 83.87% <83.87%> (ø)
packages/consul/src/configuration.ts 100.00% <100.00%> (+2.85%) ⬆️
packages/consul/src/controller/consul.ts 100.00% <100.00%> (ø)
packages/consul/src/index.ts 100.00% <100.00%> (ø)

... and 3 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@czy88840616 czy88840616 marked this pull request as ready for review July 29, 2023 04:29
@czy88840616 czy88840616 added this to the 3.12.x milestone Aug 1, 2023
@czy88840616 czy88840616 added pr: breaking change Existing sites may not build successfully in the new version. Description contains more details. pr: new feature This PR adds a new API or behavior. labels Aug 1, 2023
@czy88840616 czy88840616 changed the base branch from main to flyingCrp_new_consul August 13, 2023 15:27
@czy88840616 czy88840616 merged commit 90b3de3 into midwayjs:flyingCrp_new_consul Aug 13, 2023
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr: breaking change Existing sites may not build successfully in the new version. Description contains more details. pr: new feature This PR adds a new API or behavior.
Development

Successfully merging this pull request may close these issues.

None yet

3 participants