postgres

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PostgresStoreConfig

type PostgresStoreConfig struct {
	// Host of the Postgres DB
	Host string `yaml:"host" envconfig:"kuma_store_postgres_host"`
	// Port of the Postgres DB
	Port int `yaml:"port" envconfig:"kuma_store_postgres_port"`
	// User of the Postgres DB
	User string `yaml:"user" envconfig:"kuma_store_postgres_user"`
	// Password of the Postgres DB
	Password string `yaml:"password" envconfig:"kuma_store_postgres_password"`
	// Database name of the Postgres DB
	DbName string `yaml:"dbName" envconfig:"kuma_store_postgres_db_name"`
	// Connection Timeout to the DB in seconds
	ConnectionTimeout int `yaml:"connectionTimeout" envconfig:"kuma_store_postgres_connection_timeout"`
	// Maximum number of open connections to the database
	// `0` value means number of open connections is unlimited
	MaxOpenConnections int `yaml:"maxOpenConnections" envconfig:"kuma_store_postgres_max_open_connections"`
	// Maximum number of connections in the idle connection pool
	// <0 value means no idle connections and 0 means default max idle connections
	MaxIdleConnections int `yaml:"maxIdleConnections" envconfig:"kuma_store_postgres_max_idle_connections"`
	// TLS settings
	TLS TLSPostgresStoreConfig `yaml:"tls"`
	// MinReconnectInterval controls the duration to wait before trying to
	// re-establish the database connection after connection loss. After each
	// consecutive failure this interval is doubled, until MaxReconnectInterval
	// is reached. Successfully completing the connection establishment procedure
	// resets the interval back to MinReconnectInterval.
	MinReconnectInterval time.Duration `yaml:"minReconnectInterval" envconfig:"kuma_store_postgres_min_reconnect_interval"`
	// MaxReconnectInterval controls the maximum possible duration to wait before trying
	// to re-establish the database connection after connection loss.
	MaxReconnectInterval time.Duration `yaml:"maxReconnectInterval" envconfig:"kuma_store_postgres_max_reconnect_interval"`
}

Postgres store configuration

func DefaultPostgresStoreConfig

func DefaultPostgresStoreConfig() *PostgresStoreConfig

func (PostgresStoreConfig) ConnectionString added in v1.8.1

func (cfg PostgresStoreConfig) ConnectionString() (string, error)

func (*PostgresStoreConfig) Sanitize

func (p *PostgresStoreConfig) Sanitize()

func (*PostgresStoreConfig) Validate

func (p *PostgresStoreConfig) Validate() error

type TLSMode

type TLSMode string

Modes available here https://godoc.org/github.com/lib/pq

const (
	Disable TLSMode = "disable"
	// Always TLS (skip verification)
	VerifyNone TLSMode = "verifyNone"
	// Always TLS (verify that the certificate presented by the server was signed by a trusted CA)
	VerifyCa TLSMode = "verifyCa"
	// Always TLS (verify that the certification presented by the server was signed by a trusted CA and the server host name matches the one in the certificate)
	VerifyFull TLSMode = "verifyFull"
)

type TLSPostgresStoreConfig

type TLSPostgresStoreConfig struct {
	// Mode of TLS connection. Available values (disable, verifyNone, verifyCa, verifyFull)
	Mode TLSMode `yaml:"mode" envconfig:"kuma_store_postgres_tls_mode"`
	// Path to TLS Certificate of the client. Used in require, verifyCa and verifyFull modes
	CertPath string `yaml:"certPath" envconfig:"kuma_store_postgres_tls_cert_path"`
	// Path to TLS Key of the client. Used in verifyNone, verifyCa and verifyFull modes
	KeyPath string `yaml:"keyPath" envconfig:"kuma_store_postgres_tls_key_path"`
	// Path to the root certificate. Used in verifyCa and verifyFull modes.
	CAPath string `yaml:"caPath" envconfig:"kuma_store_postgres_tls_ca_path"`
}

func DefaultTLSPostgresStoreConfig

func DefaultTLSPostgresStoreConfig() TLSPostgresStoreConfig

func (TLSPostgresStoreConfig) Sanitize

func (s TLSPostgresStoreConfig) Sanitize()

func (TLSPostgresStoreConfig) Validate

func (s TLSPostgresStoreConfig) Validate() error

Jump to

Keyboard shortcuts

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