generators

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatConfigComment

func FormatConfigComment(key, prefix string) string

Types

type PgBouncerConfigGenerator

type PgBouncerConfigGenerator struct {
	SystemInfo        *sysinfo.SystemInfo
	TunedParams       *pgtune.TunedParameters
	DatabaseName      string
	DatabaseHost      string
	DatabasePort      int
	DatabaseUser      string
	CustomSettings    map[string]string
	DatabaseOverrides map[string]pkg.DatabaseConfig
	// contains filtered or unexported fields
}

PgBouncerConfigGenerator generates pgbouncer.ini configuration

func NewPgBouncerConfigGenerator

func NewPgBouncerConfigGenerator(sysInfo *sysinfo.SystemInfo, params *pgtune.TunedParameters) *PgBouncerConfigGenerator

NewPgBouncerConfigGenerator creates a new PgBouncer configuration generator

func (*PgBouncerConfigGenerator) AddCustomSetting

func (g *PgBouncerConfigGenerator) AddCustomSetting(key, value string)

AddCustomSetting adds a custom setting to the configuration

func (*PgBouncerConfigGenerator) AddDatabase

func (g *PgBouncerConfigGenerator) AddDatabase(name string, config pkg.DatabaseConfig)

AddDatabase adds a database configuration

func (*PgBouncerConfigGenerator) GenerateConfig

func (g *PgBouncerConfigGenerator) GenerateConfig() *pkg.PgBouncerIni

GenerateConfig generates a PgBouncer configuration struct

func (*PgBouncerConfigGenerator) GenerateConfigFile

func (g *PgBouncerConfigGenerator) GenerateConfigFile() string

GenerateConfigFile generates the actual pgbouncer.ini file content

func (*PgBouncerConfigGenerator) SetDatabaseConfig

func (g *PgBouncerConfigGenerator) SetDatabaseConfig(name, host string, port int, dbname, user string)

SetDatabaseConfig sets the default database configuration

type PgHBAConfigGenerator

type PgHBAConfigGenerator struct {
	SystemInfo        *sysinfo.SystemInfo
	Entries           []pkg.PostgrestHBA
	DefaultAuthMethod string
}

PgHBAConfigGenerator generates pg_hba.conf configuration

func NewPgHBAConfigGenerator

func NewPgHBAConfigGenerator(sysInfo *sysinfo.SystemInfo, defaultAuthMethod ...string) *PgHBAConfigGenerator

NewPgHBAConfigGenerator creates a new pg_hba.conf configuration generator

func (*PgHBAConfigGenerator) AddApplicationEntries

func (g *PgHBAConfigGenerator) AddApplicationEntries(database, user, network string)

AddApplicationEntries adds entries for specific applications

func (*PgHBAConfigGenerator) AddDevelopmentEntries

func (g *PgHBAConfigGenerator) AddDevelopmentEntries()

AddDevelopmentEntries adds permissive entries for development environments

func (*PgHBAConfigGenerator) AddEntry

func (g *PgHBAConfigGenerator) AddEntry(entry pkg.PostgrestHBA)

AddEntry adds an authentication entry

func (*PgHBAConfigGenerator) AddHostEntry

func (g *PgHBAConfigGenerator) AddHostEntry(database, user, address, method string, options map[string]string)

AddHostEntry adds a TCP/IP connection entry

func (*PgHBAConfigGenerator) AddLocalEntry

func (g *PgHBAConfigGenerator) AddLocalEntry(database, user, method string, options map[string]string)

AddLocalEntry adds a local (Unix socket) connection entry

func (*PgHBAConfigGenerator) AddNoSSLEntry

func (g *PgHBAConfigGenerator) AddNoSSLEntry(database, user, address, method string, options map[string]string)

AddNoSSLEntry adds a non-SSL connection entry

func (*PgHBAConfigGenerator) AddProductionSSLEntries

func (g *PgHBAConfigGenerator) AddProductionSSLEntries(allowedNetworks []string)

AddProductionSSLEntries adds secure SSL entries for production

func (*PgHBAConfigGenerator) AddSSLEntry

func (g *PgHBAConfigGenerator) AddSSLEntry(database, user, address, method string, options map[string]string)

AddSSLEntry adds an SSL-only connection entry

func (*PgHBAConfigGenerator) ClearEntries

func (g *PgHBAConfigGenerator) ClearEntries()

ClearEntries removes all entries

func (*PgHBAConfigGenerator) GenerateConfigFile

func (g *PgHBAConfigGenerator) GenerateConfigFile() string

GenerateConfigFile generates the actual pg_hba.conf file content

func (*PgHBAConfigGenerator) SetDefaultAuthMethod

func (g *PgHBAConfigGenerator) SetDefaultAuthMethod(method string)

SetDefaultAuthMethod updates the default authentication method

type PostgRESTConfigGenerator

type PostgRESTConfigGenerator struct {
	SystemInfo     *sysinfo.SystemInfo
	TunedParams    *pgtune.TunedParameters
	DatabaseName   string
	DatabaseHost   string
	DatabasePort   int
	DatabaseUser   string
	DatabasePass   string
	CustomSettings map[string]string
	// contains filtered or unexported fields
}

PostgRESTConfigGenerator generates PostgREST configuration

func NewPostgRESTConfigGenerator

func NewPostgRESTConfigGenerator(sysInfo *sysinfo.SystemInfo, params *pgtune.TunedParameters) *PostgRESTConfigGenerator

NewPostgRESTConfigGenerator creates a new PostgREST configuration generator

func (*PostgRESTConfigGenerator) AddCustomSetting

func (g *PostgRESTConfigGenerator) AddCustomSetting(key, value string)

AddCustomSetting adds a custom setting to the configuration

func (*PostgRESTConfigGenerator) GenerateConfig

func (g *PostgRESTConfigGenerator) GenerateConfig() (*pkg.PostgrestConf, error)

GenerateConfig generates a PostgREST configuration struct

func (*PostgRESTConfigGenerator) GenerateConfigFile

func (g *PostgRESTConfigGenerator) GenerateConfigFile() (string, error)

GenerateConfigFile generates the actual PostgREST configuration file content

func (*PostgRESTConfigGenerator) GenerateEnvFile

func (g *PostgRESTConfigGenerator) GenerateEnvFile() (string, error)

GenerateEnvFile generates a .env file for PostgREST

func (*PostgRESTConfigGenerator) GenerateUserSetupSQL

func (g *PostgRESTConfigGenerator) GenerateUserSetupSQL() string

GenerateUserSetupSQL generates SQL commands to set up PostgREST users and roles

func (*PostgRESTConfigGenerator) SetDatabaseConfig

func (g *PostgRESTConfigGenerator) SetDatabaseConfig(name, host string, port int, user, password string)

SetDatabaseConfig sets the database connection parameters

type PostgreSQLConfigGenerator

type PostgreSQLConfigGenerator struct {
	SystemInfo     *sysinfo.SystemInfo
	TunedParams    *pgtune.TunedParameters
	CustomSettings map[string]string
	// contains filtered or unexported fields
}

PostgreSQLConfigGenerator generates postgresql.conf configuration

func NewPostgreSQLConfigGenerator

func NewPostgreSQLConfigGenerator(sysInfo *sysinfo.SystemInfo, params *pgtune.TunedParameters) *PostgreSQLConfigGenerator

NewPostgreSQLConfigGenerator creates a new PostgreSQL configuration generator

func (*PostgreSQLConfigGenerator) AddCustomSetting

func (g *PostgreSQLConfigGenerator) AddCustomSetting(key, value string)

AddCustomSetting adds a custom setting to the configuration

func (*PostgreSQLConfigGenerator) GenerateConfig

func (g *PostgreSQLConfigGenerator) GenerateConfig() *pkg.PostgresConf

GenerateConfig generates a PostgreSQL configuration struct

func (*PostgreSQLConfigGenerator) GenerateConfigFile

func (g *PostgreSQLConfigGenerator) GenerateConfigFile() string

GenerateConfigFile generates the actual postgresql.conf file content

func (*PostgreSQLConfigGenerator) SetExtensions

func (g *PostgreSQLConfigGenerator) SetExtensions(extensions map[string]pkg.ExtensionConfig)

SetExtensions sets the extensions configuration

func (*PostgreSQLConfigGenerator) SetPGAuditConf

func (g *PostgreSQLConfigGenerator) SetPGAuditConf(conf *pkg.PGAuditConf)

SetPGAuditConf sets the PGAudit configuration

Jump to

Keyboard shortcuts

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