support conf varible override
Please answer these questions before submitting a pull request, or your PR will get closed.
Why submit this pull request?
add conf override pass system environment with prefix AD_, such as AD_Conf_Etcd_Username=root1 override etcd user.
What changes will this PR take into? add PathExist utils and conf override statement.
Related issues
fix/resolve #2514
Checklist:
- [x] Did you explain what problem does this PR solve? Or what new features have been added?
- [ ] Have you added corresponding test cases?
- [ ] Have you modified the corresponding document?
- [x] Is this PR backward compatible? If it is not backward compatible, please discuss on the mailing list first
Hi, @quanbisen
Thank you for your contribution, but I reviewed what was mentioned in the issue and our goal is actually to work something like this https://github.com/bzp2010/apisix-dashboard/blob/8a20a9c564dc4d1953a686077f5e0c9314b86935/api/internal/config/config.go#L97-L100
It is very simple and allows us to override a single configuration item with a variable like AD_SERVER_HTTPHOST instead of overriding the entire configuration with the entire configuration file passed in by the environment variable.
Would you like to change it?
Oh, I will make it.
Hey, I have recommited. Please review my submited code.
Codecov Report
Merging #2587 (07b8679) into master (b777d99) will decrease coverage by
2.00%. The diff coverage is70.00%.
@@ Coverage Diff @@
## master #2587 +/- ##
==========================================
- Coverage 68.50% 66.50% -2.01%
==========================================
Files 134 195 +61
Lines 3553 7538 +3985
Branches 867 867
==========================================
+ Hits 2434 5013 +2579
- Misses 1119 2232 +1113
- Partials 0 293 +293
| Flag | Coverage Δ | |
|---|---|---|
| backend-e2e-test-ginkgo | 65.01% <30.00%> (?) |
|
| backend-unit-test | 50.64% <70.00%> (?) |
|
| frontend-e2e-test | 60.20% <ø> (-8.31%) |
:arrow_down: |
Flags with carried forward coverage won't be shown. Click here to find out more.
| Impacted Files | Coverage Δ | |
|---|---|---|
| api/internal/utils/utils.go | 57.39% <57.14%> (ø) |
|
| api/internal/conf/conf.go | 65.30% <100.00%> (ø) |
|
| web/src/components/LabelsfDrawer/LabelsDrawer.tsx | 3.92% <0.00%> (-80.40%) |
:arrow_down: |
| ...b/src/pages/Route/components/DataLoader/Import.tsx | 4.91% <0.00%> (-78.69%) |
:arrow_down: |
| ...es/Route/components/DataLoader/loader/OpenAPI3.tsx | 33.33% <0.00%> (-66.67%) |
:arrow_down: |
| ...pages/Route/components/Step1/MatchingRulesView.tsx | 25.00% <0.00%> (-54.17%) |
:arrow_down: |
| web/src/pages/Route/transform.ts | 52.91% <0.00%> (-27.52%) |
:arrow_down: |
| .../src/pages/Route/components/Step1/ProxyRewrite.tsx | 70.68% <0.00%> (-24.14%) |
:arrow_down: |
| ...b/src/components/Plugin/UI/referer-restriction.tsx | 69.69% <0.00%> (-21.22%) |
:arrow_down: |
| web/src/pages/Route/List.tsx | 57.50% <0.00%> (-18.13%) |
:arrow_down: |
| ... and 73 more |
:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more