rename postgres.addr to postgres.bind for consistency

This commit is contained in:
Nia Weiss 2020-08-27 11:35:54 -04:00
parent 288593231f
commit f0f8336f57
No known key found for this signature in database
GPG key ID: 895E83409BFDA1BB
3 changed files with 5 additions and 5 deletions

View file

@ -90,7 +90,7 @@ func BuildServerFlags(cmd *cobra.Command, srv *server.Command) {
flags.StringVarP(&srv.Config.Txsrc, "tx", "", "", "transaction/storage to use: one of roaring, rbf, badger, rbf_roaring, roaring_rbf, badger_roaring, roaring_badger, badger_rbf, or rbf_badger (default roaring)")
// Postgres endpoint
flags.StringVar(&srv.Config.Postgres.Addr, "postgres.addr", srv.Config.Postgres.Addr, "address to which to bind a postgres endpoint (leave blank to disable)")
flags.StringVar(&srv.Config.Postgres.Bind, "postgres.bind", srv.Config.Postgres.Bind, "Address to which to bind a postgres endpoint (leave blank to disable)")
SetTLSConfig(flags, "postgres.", &srv.Config.Postgres.TLS.CertificatePath, &srv.Config.Postgres.TLS.CertificateKeyPath, &srv.Config.Postgres.TLS.CACertPath, &srv.Config.Postgres.TLS.SkipVerify, &srv.Config.Postgres.TLS.EnableClientVerification)
flags.DurationVar((*time.Duration)(&srv.Config.Postgres.StartupTimeout), "postgres.startup-timeout", time.Duration(srv.Config.Postgres.StartupTimeout), "Timeout for postgres connection startup. (set 0 to disable)")
flags.DurationVar((*time.Duration)(&srv.Config.Postgres.ReadTimeout), "postgres.read-timeout", time.Duration(srv.Config.Postgres.ReadTimeout), "Timeout for reads on a postgres connection. (set 0 to disable; does not include connection idling)")

View file

@ -168,9 +168,9 @@ type Config struct {
} `toml:"profile"`
Postgres struct {
// Addr is the address to which to bind a postgres endpoint.
// Bind is the address to which to bind a postgres endpoint.
// If this is empty, no endpoint will be created.
Addr string `toml:"addr"`
Bind string `toml:"bind"`
// TLS configuration for postgres connections.
TLS TLSConfig `toml:"tls"`

View file

@ -176,7 +176,7 @@ func (m *Command) Start() (err error) {
// Initialize postgres.
m.pgserver = nil
if m.Config.Postgres.Addr != "" {
if m.Config.Postgres.Bind != "" {
var tlsConf *tls.Config
if m.Config.Postgres.TLS.CertificatePath != "" {
conf, err := GetTLSConfig(&m.Config.Postgres.TLS, m.logger.Logger())
@ -191,7 +191,7 @@ func (m *Command) Start() (err error) {
m.pgserver.s.WriteTimeout = time.Duration(m.Config.Postgres.WriteTimeout)
m.pgserver.s.MaxStartupSize = m.Config.Postgres.MaxStartupSize
m.pgserver.s.ConnectionLimit = m.Config.Postgres.ConnectionLimit
err := m.pgserver.Start(m.Config.Postgres.Addr)
err := m.pgserver.Start(m.Config.Postgres.Bind)
if err != nil {
return errors.Wrap(err, "starting postgres")
}