From 1639bbc6b51f2047277eb2421d904b0a8fd39879 Mon Sep 17 00:00:00 2001 From: Dov Alperin Date: Tue, 17 Jan 2023 12:00:10 -0500 Subject: [PATCH] Truncate repmgr config on initialize Closes #35 --- pkg/flypg/repmgr.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/flypg/repmgr.go b/pkg/flypg/repmgr.go index a3df972e..93a3fedd 100644 --- a/pkg/flypg/repmgr.go +++ b/pkg/flypg/repmgr.go @@ -72,7 +72,7 @@ func (r *RepMgr) NewRemoteConnection(ctx context.Context, hostname string) (*pgx func (r *RepMgr) initialize() error { r.setDefaults() - f, err := os.OpenFile(r.ConfigPath, os.O_APPEND|os.O_WRONLY|os.O_CREATE, 0600) + f, err := os.OpenFile(r.ConfigPath, os.O_APPEND|os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0600) if err != nil { return nil }