summaryrefslogtreecommitdiff
path: root/internal/db/bundb/bundb.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/db/bundb/bundb.go')
-rw-r--r--internal/db/bundb/bundb.go12
1 files changed, 7 insertions, 5 deletions
diff --git a/internal/db/bundb/bundb.go b/internal/db/bundb/bundb.go
index 033be558f..4634f1981 100644
--- a/internal/db/bundb/bundb.go
+++ b/internal/db/bundb/bundb.go
@@ -54,7 +54,7 @@ const (
dbTypeSqlite = "sqlite"
)
-var registerTables []interface{} = []interface{}{
+var registerTables = []interface{}{
&gtsmodel.StatusToEmoji{},
&gtsmodel.StatusToTag{},
}
@@ -220,7 +220,7 @@ func sqliteConn(ctx context.Context, c *config.Config) (*DBConn, error) {
}
tweakConnectionValues(sqldb)
-
+
if c.DBConfig.Address == "file::memory:?cache=shared" {
logrus.Warn("sqlite in-memory database should only be used for debugging")
// don't close connections on disconnect -- otherwise
@@ -248,11 +248,11 @@ func pgConn(ctx context.Context, c *config.Config) (*DBConn, error) {
if err != nil {
return nil, fmt.Errorf("could not create bundb postgres options: %s", err)
}
-
+
sqldb := stdlib.OpenDB(*opts)
-
+
tweakConnectionValues(sqldb)
-
+
conn := WrapDBConn(bun.NewDB(sqldb, pgdialect.New()))
// ping to check the db is there and listening
@@ -305,6 +305,7 @@ func deriveBunDBPGOptions(c *config.Config) (*pgx.ConnConfig, error) {
case config.DBTLSModeDisable, config.DBTLSModeUnset:
break // nothing to do
case config.DBTLSModeEnable:
+ /* #nosec G402 */
tlsConfig = &tls.Config{
InsecureSkipVerify: true,
}
@@ -312,6 +313,7 @@ func deriveBunDBPGOptions(c *config.Config) (*pgx.ConnConfig, error) {
tlsConfig = &tls.Config{
InsecureSkipVerify: false,
ServerName: c.DBConfig.Address,
+ MinVersion: tls.VersionTLS12,
}
}