further yak shaving
This commit is contained in:
@ -23,6 +23,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/url"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/go-fed/activity/streams/vocab"
|
||||
@ -95,7 +96,7 @@ func newPostgresService(ctx context.Context, config *Config, log *logrus.Entry)
|
||||
// derivePGOptions takes an application config and returns either a ready-to-use *pg.Options
|
||||
// with sensible defaults, or an error if it's not satisfied by the provided config.
|
||||
func derivePGOptions(config *Config) (*pg.Options, error) {
|
||||
if config.Type != dbTypePostgres {
|
||||
if strings.ToUpper(config.Type) != dbTypePostgres {
|
||||
return nil, fmt.Errorf("expected db type of %s but got %s", dbTypePostgres, config.Type)
|
||||
}
|
||||
|
||||
|
@ -46,13 +46,14 @@ type Service interface {
|
||||
|
||||
// Config provides configuration options for the database connection
|
||||
type Config struct {
|
||||
Type string
|
||||
Address string
|
||||
Port int
|
||||
User string
|
||||
Password string
|
||||
Database string
|
||||
ApplicationName string
|
||||
Type string `json:"type,omitempty"`
|
||||
Address string `json:"address,omitempty"`
|
||||
Port int `json:"port,omitempty"`
|
||||
User string `json:"user,omitempty"`
|
||||
Password string `json:"password,omitempty"`
|
||||
PasswordFile string `json:"passwordFile,omitempty"`
|
||||
Database string `json:"database,omitempty"`
|
||||
ApplicationName string `json:"applicationName,omitempty"`
|
||||
}
|
||||
|
||||
// NewService returns a new database service that satisfies the Service interface and, by extension,
|
||||
|
Reference in New Issue
Block a user