Skip to content

Commit 5ab821c

Browse files
authored
Don't fail to boot if can't sync config from consul (#132)
* Don't fail to boot if can't sync config from consul * Don't overrite on failure
1 parent 2edbb3d commit 5ab821c

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

internal/flypg/pg.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -230,11 +230,15 @@ func (c *PGConfig) initialize(store *state.Store) error {
230230
}
231231

232232
if err := SyncUserConfig(c, store); err != nil {
233-
return fmt.Errorf("failed to sync user config from consul for postgres: %s", err.Error())
234-
}
235-
236-
if err := WriteConfigFiles(c); err != nil {
237-
return fmt.Errorf("failed to write pg config files: %s", err)
233+
fmt.Printf("WARNING: Failed to sync user config from consul for postgres: %s\n", err.Error())
234+
fmt.Println(" This may cause this node to behave unexpectedly")
235+
if err := writeInternalConfigFile(c); err != nil {
236+
return fmt.Errorf("failed to write pg config files: %s", err)
237+
}
238+
} else {
239+
if err := WriteConfigFiles(c); err != nil {
240+
return fmt.Errorf("failed to write pg config files: %s", err)
241+
}
238242
}
239243

240244
return nil

0 commit comments

Comments
 (0)