(data map[string]any, dumpSuffix string, dumpFormat string)
| 228 | } |
| 229 | |
| 230 | func writeDataExport(data map[string]any, dumpSuffix string, dumpFormat string) { |
| 231 | unixTimestamp := time.Now().UnixMilli() |
| 232 | outputFilename := fmt.Sprintf("%d_%s.json", unixTimestamp, dumpSuffix) |
| 233 | |
| 234 | objectToExport := map[string]any{ |
| 235 | "Data": data, |
| 236 | "Format": dumpFormat, |
| 237 | } |
| 238 | |
| 239 | jsonExportMap, _ := json.MarshalIndent(objectToExport, "", " ") |
| 240 | |
| 241 | err := os.MkdirAll(ExportDir, 0755) |
| 242 | if err != nil { |
| 243 | updateLog(fmt.Sprintf("%s", err), "red") |
| 244 | } |
| 245 | |
| 246 | outputFilepath := filepath.Join(ExportDir, outputFilename) |
| 247 | err = ioutil.WriteFile(outputFilepath, jsonExportMap, 0644) |
| 248 | |
| 249 | if err != nil { |
| 250 | updateLog(fmt.Sprintf("%s", err), "red") |
| 251 | } else { |
| 252 | updateLog("File '"+outputFilepath+"' saved successfully!", "green") |
| 253 | } |
| 254 | } |
| 255 | |
| 256 | func upgradeStartTLS() { |
| 257 | go func() { |
no test coverage detected