utils

package
v0.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 18, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package utils provides utility functions that help with configuring pgBackrest

Index

Constants

This section is empty.

Variables

View Source
var PgbackrestServiceEnvVarPattern = regexp.MustCompile("^PGBACKREST_(?:[A-Z0-9]+_)*(?:PORT|SERVICE)")

PgbackrestServiceEnvVarPattern should match all service discovery environment variables injected to the pod by Kubernetes for services with names starting with "pgbackrest".

Functions

func FormatDbEnv

func FormatDbEnv(database int, env string, value string) string

FormatDbEnv takes a zero-based database index, an environment variable name and its value. It returns a properly formatted db-scoped variable with a prefix used by pgBackRest to detect its config variables. Returned value is ready to be passed as a part of the command's env array.

func FormatDbFlag

func FormatDbFlag(database int, flag string) string

FormatDbFlag takes a zero-based database index and a flag name and returns a properly formatted db-scoped flag ready to be passed as a command argument.

func FormatEnv

func FormatEnv(env string, value string) string

FormatEnv takes an environment variable name and its value. It returns a properly formatted variable with a prefix used by pgBackRest to detect its config variables. Returned value is ready to be passed as a part of the command's env array.

func FormatRepoEnv

func FormatRepoEnv(repository int, env string, value string) string

FormatRepoEnv takes a zero-based repository index, an environment variable name and its value. It returns a properly formatted repo-scoped variable with a prefix used by pgBackRest to detect its config variables. Returned value is ready to be passed as a part of the command's env array.

func FormatRepoFlag

func FormatRepoFlag(repository int, flag string) string

FormatRepoFlag takes a zero-based repository index and a flag name and returns a properly formatted repo-scoped flag ready to be passed as a command argument.

func SanitizedEnviron

func SanitizedEnviron() []string

SanitizedEnviron returns a copy of the environment variables list with variables added for Kubernetes services with names starting from "pgbackrest" removed. Those variables cause pgbackrest to output warnings during configuration parsing and those messages always go to the standard output causing issues with "pgbackrest info" calls as those should only output JSON. In addition, removing them makes log entries much clearer.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL