-
Notifications
You must be signed in to change notification settings - Fork 5k
Allow disable audit log to DB when initialize #22350
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
base: main
Are you sure you want to change the base?
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #22350 +/- ##
==========================================
+ Coverage 45.36% 46.68% +1.31%
==========================================
Files 244 252 +8
Lines 13333 14252 +919
Branches 2719 2927 +208
==========================================
+ Hits 6049 6653 +604
- Misses 6983 7244 +261
- Partials 301 355 +54
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
b2e51b9
to
1d4fa4e
Compare
5bfa645
to
177b920
Compare
|
||
// get from db | ||
mgr := config.GetCfgManager(ctx) | ||
cfg, err := mgr.GetItemFromDriver(ctx, common.SkipAuditLogDatabase) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It can use the mgr.Get(), if the value is not set, this method will return a pre-defined error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mgr.Get() get the k-v from the store map instead of the db driver directly. And it will always has a default values once cfgValues loaded
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should implement the function to check if k = common.SkipAuditLogDatabase exists in the properties table. not GetItermFromDriver()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For sure I could implement either check the key existence in the db or like now return k-v from db.
However I think get a k-v from db can be more generically used in the future compare to return the key existence bool value solely.
func initSkipAuditDBbyEnv(ctx context.Context) error { | ||
var err error | ||
skipAuditEnv := false | ||
s := os.Getenv("SKIP_LOG_AUDIT_DATABASE") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggest to add _INIT suffix so that it can be self explained.
Signed-off-by: my036811 <miner.yang@broadcom.com>
177b920
to
342b081
Compare
Hi @wy65701436 , Due to personal time break, please help to keep working on this issue. Appreciate! Best, |
Thank you for contributing to Harbor!
Comprehensive Summary of your change
Issue being fixed
Fixes #(22257)
Please indicate you've done the following: