Skip to content

Commit

Permalink
Allow archiving to be disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
davissp14 committed Jun 25, 2024
1 parent 2d4b622 commit b859216
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion internal/flypg/pg.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,8 @@ func (c *PGConfig) SetDefaults() error {
}

// Works to configure archiving to object storage if enabled
if os.Getenv("CLOUD_ARCHIVING_ENABLED") == "true" {
switch os.Getenv("CLOUD_ARCHIVING_ENABLED") {
case "true":
if err := validateCloudArchiver(); err != nil {
return fmt.Errorf("failed to validate s3 archiver: %s", err)
}
Expand All @@ -184,6 +185,11 @@ func (c *PGConfig) SetDefaults() error {
archiveCommand := fmt.Sprintf("'barman-cloud-wal-archive --cloud-provider aws-s3 --endpoint-url %s s3://%s %s %%p'", endpoint, bucket, c.AppName)
c.internalConfig["archive_mode"] = "on"
c.internalConfig["archive_command"] = archiveCommand
case "false":
c.internalConfig["archive_mode"] = "off"
default:
// Noop to remain backwards compatible with existing setups that may have
// manually setup archiving.
}

return nil
Expand Down

0 comments on commit b859216

Please sign in to comment.