summaryrefslogtreecommitdiff
path: root/internal/db
diff options
context:
space:
mode:
Diffstat (limited to 'internal/db')
-rw-r--r--internal/db/postgres.go3
-rw-r--r--internal/db/service.go15
2 files changed, 10 insertions, 8 deletions
diff --git a/internal/db/postgres.go b/internal/db/postgres.go
index f4cf47406..14c8d3d7b 100644
--- a/internal/db/postgres.go
+++ b/internal/db/postgres.go
@@ -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)
}
diff --git a/internal/db/service.go b/internal/db/service.go
index 9a1d3ce2c..6c738606e 100644
--- a/internal/db/service.go
+++ b/internal/db/service.go
@@ -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,