Skip to content

Commit b9e2af7

Browse files
committed
fix: add redacted config to support bundle
1 parent 2c2868f commit b9e2af7

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

SushitrainCore/src/sushitrain.go

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1514,10 +1514,12 @@ func (c *Client) GenerateSupportBundle() ([]byte, error) {
15141514
infoJson["hasMigratedLegacyDatabase"] = c.HasMigratedLegacyDatabase()
15151515
infoJson["connectedPeerCount"] = c.ConnectedPeerCount()
15161516
infoJson["bundleGeneratedAt"] = time.Now().Format(time.RFC3339)
1517-
jsonData, err := json.Marshal(infoJson)
1517+
infoJson["redactedConfig"] = c.getRedactedConfigFile()
1518+
jsonData, err := json.MarshalIndent(infoJson, "", "\t")
15181519
if err != nil {
15191520
return nil, err
15201521
}
1522+
jsonData = []byte(redactLogLine(string(jsonData)))
15211523
jsonWriter, err := zipWriter.Create("info.json")
15221524
if err != nil {
15231525
return nil, err
@@ -1542,6 +1544,18 @@ func (c *Client) GenerateSupportBundle() ([]byte, error) {
15421544
return archive.Bytes(), nil
15431545
}
15441546

1547+
func (c *Client) getRedactedConfigFile() config.Configuration {
1548+
rawConf := c.config.RawCopy()
1549+
rawConf.GUI.APIKey = "•••"
1550+
if rawConf.GUI.Password != "" {
1551+
rawConf.GUI.Password = "•••"
1552+
}
1553+
if rawConf.GUI.User != "" {
1554+
rawConf.GUI.User = "•••"
1555+
}
1556+
return rawConf
1557+
}
1558+
15451559
/** Returns the free disk space on the volume where the database is stored */
15461560
func GetFreeDiskSpaceMegaBytes() int {
15471561
dbPath := locations.Get(locations.Database)

0 commit comments

Comments
 (0)