Documentation
¶
Overview ¶
Package utils provides utility functions that help with configuring pgBackrest
Index ¶
- Variables
- func FormatDbEnv(database int, env string, value string) string
- func FormatDbFlag(database int, flag string) string
- func FormatEnv(env string, value string) string
- func FormatRepoEnv(repository int, env string, value string) string
- func FormatRepoFlag(repository int, flag string) string
- func SanitizedEnviron() []string
Constants ¶
This section is empty.
Variables ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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.