Skip to content

Commit

Permalink
Refine the code
Browse files Browse the repository at this point in the history
Signed-off-by: JmPotato <ghzpotato@gmail.com>
  • Loading branch information
JmPotato committed Jun 27, 2024
1 parent 40b826f commit 0a46d23
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions pkg/mcs/resourcemanager/server/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ func (c *Config) Adjust(meta *toml.MetaData) error {
if err := c.Security.Encryption.Adjust(); err != nil {
return err
}

c.Controller.Adjust(configMetaData.Child("controller"))
configutil.AdjustInt64(&c.LeaderLease, utils.DefaultLeaderLease)

Expand Down
3 changes: 3 additions & 0 deletions pkg/utils/logutil/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,8 @@ func redactInfo(input string) string {
res.Grow(len(input) + 2)
_, _ = res.WriteRune(leftMark)
for _, c := range input {
// Double the mark character if it is already in the input string.
// to avoid the ambiguity of the redacted content.
if c == leftMark || c == rightMark {
_, _ = res.WriteRune(c)
_, _ = res.WriteRune(c)
Expand Down Expand Up @@ -229,6 +231,7 @@ func RedactBytes(arg []byte) []byte {
case RedactInfoLogON:
return []byte("?")
case RedactInfoLogMark:
// Use unsafe conversion to avoid copy.
return typeutil.StringToBytes(redactInfo(typeutil.BytesToString(arg)))
default:
}
Expand Down

0 comments on commit 0a46d23

Please sign in to comment.