Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/flypg/pg.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ func (c *PGConfig) initialize() error {
}

func (c *PGConfig) writePGConfigEntries(entries []string) error {
file, err := os.Create(c.configFilePath)
file, err := os.OpenFile(c.configFilePath, os.O_APPEND|os.O_WRONLY|os.O_CREATE, 0600)
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions internal/flypg/repmgr.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func (r *RepMgr) initialize() error {
return fmt.Errorf("failed to set repmgr.conf ownership: %s", err)
}

return file.Sync()
return nil
}

func (r *RepMgr) setup(ctx context.Context, conn *pgx.Conn) error {
Expand Down Expand Up @@ -236,7 +236,7 @@ func (r *RepMgr) clonePrimary(ipStr string) error {

func (r *RepMgr) writePasswdConf() error {
path := "/data/.pgpass"
file, err := os.Create(path)
file, err := os.OpenFile(path, os.O_CREATE|os.O_RDWR|os.O_TRUNC, 0600)
if err != nil {
return fmt.Errorf("failed to open repmgr password file: %s", err)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/flypg/restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ func restoreHBAFile() error {
}

func setRestoreLock() error {
file, err := os.Create(restoreLockFile)
file, err := os.OpenFile(restoreLockFile, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0600)
if err != nil {
return err
}
Expand Down