MCPcopy
hub / github.com/syncthing/syncthing / getRedactedConfig

Function getRedactedConfig

lib/api/support_bundle.go:17–36  ·  view source on GitHub ↗

getRedactedConfig redacting some parts of config

(s *service)

Source from the content-addressed store, hash-verified

15
16// getRedactedConfig redacting some parts of config
17func getRedactedConfig(s *service) config.Configuration {
18 rawConf := s.cfg.RawCopy()
19 rawConf.GUI.APIKey = "REDACTED"
20 if rawConf.GUI.Password != "" {
21 rawConf.GUI.Password = "REDACTED"
22 }
23 if rawConf.GUI.User != "" {
24 rawConf.GUI.User = "REDACTED"
25 }
26
27 for folderIdx, folderCfg := range rawConf.Folders {
28 for deviceIdx, deviceCfg := range folderCfg.Devices {
29 if deviceCfg.EncryptionPassword != "" {
30 rawConf.Folders[folderIdx].Devices[deviceIdx].EncryptionPassword = "REDACTED"
31 }
32 }
33 }
34
35 return rawConf
36}
37
38// writeZip writes a zip file containing the given entries
39func writeZip(writer io.Writer, files []fileEntry) error {

Callers 1

getSupportBundleMethod · 0.85

Calls 1

RawCopyMethod · 0.65

Tested by

no test coverage detected