zot
zot copied to clipboard
feat: added support for changing config via API
closes #268, closes #698
Signed-off-by: Petu Eusebiu [email protected]
What does this PR do / Why do we need it:
-
added a http handler to GET current zot config or POST a new one
-
only admins can GET/POST configs
-
~~after zot successfully starts its server it will back up the current configuration~~
-
after a POST config, zot will validate it and restart the server with the new configuration ~~if the server crashes because of config errors zot will restore the config to the last backup.~~ (not anymore)
-
the config file which zot starts with is the single source of configuration and it will always reflect the current configuration of a running zot.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Codecov Report
Merging #729 (8efbe56) into main (2d877aa) will increase coverage by
0.10%
. The diff coverage is94.91%
.
@@ Coverage Diff @@
## main #729 +/- ##
==========================================
+ Coverage 88.75% 88.85% +0.10%
==========================================
Files 73 77 +4
Lines 13847 14009 +162
==========================================
+ Hits 12290 12448 +158
- Misses 1212 1215 +3
- Partials 345 346 +1
Impacted Files | Coverage Δ | |
---|---|---|
pkg/api/config/config.go | 88.57% <ø> (-0.66%) |
:arrow_down: |
pkg/api/authn.go | 85.71% <50.00%> (ø) |
|
pkg/cli/root.go | 88.80% <72.41%> (-6.63%) |
:arrow_down: |
pkg/cli/config_reloader.go | 81.01% <80.95%> (-0.24%) |
:arrow_down: |
pkg/api/config/loader.go | 92.00% <92.00%> (ø) |
|
pkg/api/authz.go | 98.40% <100.00%> (+0.08%) |
:arrow_up: |
pkg/api/config/validator.go | 100.00% <100.00%> (ø) |
|
pkg/api/controller.go | 92.72% <100.00%> (-0.24%) |
:arrow_down: |
pkg/api/routes.go | 96.83% <100.00%> (+<0.01%) |
:arrow_up: |
pkg/extensions/extension-config-disabled.go | 100.00% <100.00%> (ø) |
|
... and 7 more |
:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more