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

Ftr: provide a default config #1073

Merged
merged 9 commits into from
Mar 21, 2021
Merged

Ftr: provide a default config #1073

merged 9 commits into from
Mar 21, 2021

Conversation

cjphaha
Copy link
Member

@cjphaha cjphaha commented Mar 4, 2021

What this PR does:
If the path of the configuration file cannot be obtained from the environment variables or the startup parameters, the system will search for the configuration file from the default location. If the configuration file fails to read, the default parameters will be set
Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

  • Put the config files in profiles folder. by default, the configuration file should be placed like this
.
├── app
│   ├── client.go
│   └── user.go
└── profiles
   ├── client.yml
   └── log.yml
  • You can start the program widthout setting conConf and proConf:
go run .

@cjphaha cjphaha changed the title Develop Ftr: provide a default config Mar 4, 2021
@AlexStocks AlexStocks requested review from fangyincheng, flycash, aliiohs and gaoxinge and removed request for fangyincheng and flycash March 5, 2021 05:00
@AlexStocks AlexStocks added this to the v3.0.0 milestone Mar 7, 2021
Copy link
Member

@zouyx zouyx left a comment

Choose a reason for hiding this comment

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

Could you make checking success?

@cjphaha
Copy link
Member Author

cjphaha commented Mar 9, 2021

Could you make checking success?

Sorry, Recently I encountered some difficulties, Now I have changed the way of setting default parameters. It can be passed on my local computer.

@codecov-io
Copy link

Codecov Report

Merging #1073 (d6f0f24) into 3.0 (a347a04) will decrease coverage by 0.50%.
The diff coverage is 55.49%.

Impacted file tree graph

@@            Coverage Diff             @@
##              3.0    #1073      +/-   ##
==========================================
- Coverage   60.03%   59.53%   -0.51%     
==========================================
  Files         260      268       +8     
  Lines       12855    13398     +543     
==========================================
+ Hits         7718     7976     +258     
- Misses       4174     4438     +264     
- Partials      963      984      +21     
Impacted Files Coverage Δ
cluster/cluster_impl/available_cluster.go 100.00% <ø> (ø)
cluster/cluster_impl/zone_aware_cluster_invoker.go 64.28% <ø> (ø)
cluster/router/healthcheck/default_health_check.go 100.00% <ø> (+5.88%) ⬆️
cluster/router/healthcheck/factory.go 66.66% <0.00%> (ø)
cluster/router/tag/router_rule.go 89.47% <ø> (+12.20%) ⬆️
common/config/environment.go 51.72% <ø> (ø)
common/extension/config_post_processor.go 0.00% <0.00%> (ø)
common/extension/conn_checker.go 0.00% <0.00%> (ø)
common/extension/metadata_service.go 0.00% <0.00%> (ø)
common/proxy/proxy_factory/default.go 13.55% <0.00%> (ø)
... and 135 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f1f81eb...d6f0f24. Read the comment docs.

@zouyx zouyx added the enhancement New feature or request label Mar 15, 2021
// Even though baseConfig has been initialized, we override it
// because we think read from config file is correct config
baseConfig = &providerConfig.BaseConfig
}
}

// setDefaultValue set default value for providerConfig or consumerConfig if it is null
func setDefaultValue(target interface{}) {
Copy link
Member

Choose a reason for hiding this comment

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

Can you use annotation in this line for default value?

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you use annotation in this line for default value?

in go we can use annotation as Java?

Copy link
Member

Choose a reason for hiding this comment

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

let me see see and study study. hhhh

@AlexStocks AlexStocks merged commit 4640167 into apache:3.0 Mar 21, 2021
AlexStocks added a commit that referenced this pull request Apr 14, 2021
Ftr: provide a default config
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants