Create all config/entry files (both local and remote) with 0600 permissions

This commit is contained in:
2024-08-13 17:20:15 -04:00
parent cbf9139713
commit 88b7a6be6d
16 changed files with 62 additions and 45 deletions
+3 -3
View File
@@ -52,7 +52,7 @@ func WriteEntry(targetLocation string, entryData []string, verifyEntryDoesNotExi
encryptedBytes := EncryptGPG(entryData)
err := os.WriteFile(targetLocation, encryptedBytes, 0600)
if err != nil {
fmt.Println(AnsiError + "Failed to write to file: " + err.Error() + AnsiReset)
fmt.Println(AnsiError+"Failed to write to file:", err.Error()+AnsiReset)
os.Exit(102)
}
}
@@ -61,7 +61,7 @@ func WriteEntry(targetLocation string, entryData []string, verifyEntryDoesNotExi
func writeToStdin(cmd *exec.Cmd, input string) {
stdin, err := cmd.StdinPipe()
if err != nil {
fmt.Println(AnsiError + "Failed to access stdin for system command: " + err.Error() + AnsiReset)
fmt.Println(AnsiError+"Failed to access stdin for system command:", err.Error()+AnsiReset)
os.Exit(111)
}
@@ -77,7 +77,7 @@ func writeToStdin(cmd *exec.Cmd, input string) {
func CreateTempFile() *os.File {
tempFile, err := os.CreateTemp("", "*.markdown")
if err != nil {
fmt.Println(AnsiError + "Failed to create temporary file: " + err.Error() + AnsiReset)
fmt.Println(AnsiError+"Failed to create temporary file:", err.Error()+AnsiReset)
os.Exit(102)
}
return tempFile