Documentation
¶
Index ¶
- type AgentConfig
- type DbConfig
- func (c *DbConfig) AfterApply() error
- func (c *DbConfig) BackupDbDir(dbName string) string
- func (c *DbConfig) Host(info *InstanceInfo) string
- func (c *DbConfig) IsReservedName(name string) bool
- func (c *DbConfig) NewBackupFile(dbName string) string
- func (c *DbConfig) NewPoolConfig() *pgxpool.Config
- func (c *DbConfig) Url(dbName string, info *InstanceInfo) string
- func (c *DbConfig) ValidateBackupPath(backupPath string, dbName string) (pgVersionInPath int32, err error)
- type GrpcClientConfig
- type InstanceInfo
- type TlsConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AgentConfig ¶
type AgentConfig struct {
Db DbConfig `embed:"" prefix:"db-" group:"db"`
Grpc GrpcClientConfig `embed:"" prefix:"grpc-" group:"grpc"`
}
type DbConfig ¶
type DbConfig struct {
// The database names that are reserved and cannot be created.
ReserveNames []string `default:"postgres,template0,template1"`
// The pg instance host.
HostTemplate string `env:"PG_HELPER_DB_HOST_TEMPLATE"`
InstanceName string `env:"PG_HELPER_DB_INSTANCE"`
// The pg instance port.
Port int `default:"5432"`
// The pg instance super user.
User string `default:"postgres"`
// The default database use by super user
Name string `default:"postgres"`
// The password of the super user.
Password string `env:"PG_HELPER_DB_PASSWORD" name:"password"`
// The file save the password
PasswordFile string `env:"PG_HELPER_DB_PASSWORD_FILE"`
// The max connections to the database.
MaxConns int32 `default:"4"`
// The path of the database backups.
BackupRootPath string `default:"/var/lib/pg-helper/backups"`
// The majar version of the database that pg-helper work with.
CurrentVersion int32 `env:"PG_MAJOR"`
// contains filtered or unexported fields
}
func (*DbConfig) AfterApply ¶
func (*DbConfig) BackupDbDir ¶
func (*DbConfig) Host ¶
func (c *DbConfig) Host(info *InstanceInfo) string
func (*DbConfig) IsReservedName ¶
func (*DbConfig) NewBackupFile ¶
The backup file is relative to the BackupRootPath
func (*DbConfig) NewPoolConfig ¶
type GrpcClientConfig ¶
type GrpcClientConfig struct {
Tls TlsConfig `embed:"" prefix:"tls-" group:"grpc-tls"`
Url string `validate:"required,grpcurl" help:"The url that grpc client to connect to"`
ServerName string `validate:"omitempty,fqdn" help:"The server name that grpc client to connect to"`
AuthTokenFile string `validate:"omitempty,file" env:"PG_HELPER_GRPC_AUTH_TOKEN_FILE" group:"grpc-auth"`
}
func (*GrpcClientConfig) AuthToken ¶
func (g *GrpcClientConfig) AuthToken() (string, error)
type InstanceInfo ¶
type InstanceInfo struct {
InstanceName string
}
type TlsConfig ¶
type TlsConfig struct {
Enabled bool `default:"false" help:"Enable Tls"`
ClientTrustedCaCerts string `validate:"omitempty,file" help:"Path to the client trusted ca certs"`
MTLSEnabled bool `name:"mtls-enabled" default:"false" help:"Enable mutual tls" group:"grpc-mtls"`
ClientCert string `validate:"required_if=MTLSEnabled true,omitempty,file" help:"Path to the client tls cert" group:"grpc-mtls"`
ClientKey string `validate:"required_if=MTLSEnabled true,omitempty,file" help:"Path to the client tls key" group:"grpc-mtls"`
}
func (*TlsConfig) Credentials ¶
func (t *TlsConfig) Credentials() (credentials.TransportCredentials, error)
Click to show internal directories.
Click to hide internal directories.