Skip to content
This repository has been archived by the owner on Jun 18, 2020. It is now read-only.

Commit

Permalink
outputFile mode 0644
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan Tuzhilkin committed Jan 14, 2020
1 parent a4e06e1 commit 8b8335c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,13 @@ func write(data []Target) error {
if err != nil {
return errors.Wrap(err, "could not write to temp file")
}

defer log.Println("written", *outputFile)
return os.Rename(tmpfile.Name(), *outputFile)
if err := os.Rename(tmpfile.Name(), *outputFile); err != nil {
log.Fatal(err)
}
// Set file mode to '0644' instead of '0600' by default for tmpfile
return os.Chmod(*outputFile, 0644)
}

// Target is a target that marshal into the file_sd prometheus json format
Expand Down

0 comments on commit 8b8335c

Please sign in to comment.