Documentation
¶
Index ¶
Constants ¶
const VaultPlaceholder = "VAULT_MANAGED"
VaultPlaceholder is what every Vault-managed secret reads in the committed config until Runway injects the real value as an env var (README, "Vault-managed secrets"). The string is public, so a config still carrying it has to stop the service at boot.
Variables ¶
This section is empty.
Functions ¶
func ApplicationNameFor ¶ added in v1.116.0
ApplicationNameFor returns the application_name for a service's connections, iam-<service>, whichever process hosts the service.
func RejectPlaceholder ¶ added in v1.88.1
RejectPlaceholder fails a secret field left at VaultPlaceholder. An empty value passes, so each validator keeps its own rule on whether the field is required.
Types ¶
type DBProvider ¶
type DBProvider interface {
GetDatabaseConfig() DatabaseConfig
}
type DatabaseConfig ¶
type DatabaseConfig struct {
Driver DatabaseDriver `mapstructure:"driver"`
Name string `mapstructure:"name"`
// Host is a network host, or a UNIX socket directory when it starts with
// a slash (for example /var/run/postgresql).
Host string `mapstructure:"host"`
Port int `mapstructure:"port"`
// Username / Password identify the service role used for ordinary business
// logic (DML). With the endpoint source this role is deliberately
// unprivileged and cannot run migrations; with the infrastructure source it
// is also the migration role (see databaseConfig in pkg/config).
Username string `mapstructure:"username"`
Password string `mapstructure:"password"`
// MigrationUsername / MigrationPassword identify the migration role, which
// holds the elevated privileges (DDL, schema ownership) that migrations need
// and DML does not. Only the cmd/migrate entry-point uses these.
MigrationUsername string `mapstructure:"migration_username"`
MigrationPassword string `mapstructure:"migration_password"`
SSLMode string `mapstructure:"ssl_mode"`
MaxConnections int `mapstructure:"max_connections"`
MinIdleConnections int `mapstructure:"min_idle_connections"`
// ApplicationName is the application_name the service's connections send.
// pkg/boot sets it from the service name; it is not a config key.
ApplicationName string `mapstructure:"-"`
DataSource string
}
func (*DatabaseConfig) BuildDataSource ¶
func (d *DatabaseConfig) BuildDataSource()
BuildDataSource resolves DataSource for the service role (Username/Password), used by the running services for business logic.
func (*DatabaseConfig) BuildMigrationDataSource ¶ added in v1.35.0
func (d *DatabaseConfig) BuildMigrationDataSource()
BuildMigrationDataSource resolves DataSource for the migration role (MigrationUsername/MigrationPassword), used by cmd/migrate.
func (*DatabaseConfig) Validate ¶
func (d *DatabaseConfig) Validate() error
Validate validates the config for the running services, which connect as the service role.
func (*DatabaseConfig) ValidateMigration ¶ added in v1.35.0
func (d *DatabaseConfig) ValidateMigration() error
ValidateMigration validates the config for the cmd/migrate entry-point, which connects as the migration role. An unset migration user fails loudly here rather than connecting as an empty user.
type DatabaseDriver ¶
type DatabaseDriver string
const ( DatabaseDriverPostgres DatabaseDriver = "postgres" DatabaseDriverYugabyte DatabaseDriver = "yugabyte" )
func (DatabaseDriver) IsValid ¶
func (d DatabaseDriver) IsValid() bool