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

feat: enhance user-side configuration style #2414

Merged
merged 14 commits into from
Sep 4, 2023

Conversation

DMwangnima
Copy link
Contributor

@DMwangnima DMwangnima commented Sep 2, 2023

Please see protocol/triple/internal/client for details.

We moved all bare configurations from config package to global package almostly. Please refer to #2406 #2413. These configurations contain ReferenceConfig. As a result, user-side code would change like this if users make use of client layer directly:

cli, err := client.NewClient(
    client.WithReferenceConfig(
        global.WithReference_URL("127.0.0.1:20000"),
    ),
)

For users getting started, understanding the conception of Reference is a little bit difficult. They would be more receptive to this form:

cli, err := client.NewClient(
    client.WithURL("127.0.0.1:20000"),
)

They do not need to understand Reference and import global package. All the contents they need belong to client package.

We provide this type of API for client package because client package is a very clear module. Configurations only belong to a module could be provided with <module_name>.WithXXX. And configurations relied on by many modules could be provided with global.With<config_name>_XXX.

@sonarcloud
Copy link

sonarcloud bot commented Sep 2, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

Copy link
Contributor

@chickenlj chickenlj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@chickenlj chickenlj merged commit a19cf22 into apache:feature-triple Sep 4, 2023
4 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants