diff options
author | 2021-11-22 08:46:19 +0100 | |
---|---|---|
committer | 2021-11-22 08:46:19 +0100 | |
commit | f8630348b4c14215d87921962a2acbe8d3b6c981 (patch) | |
tree | 8a06b1e91ca408de2451a79fee44de831456d729 /internal/db/bundb/bundb.go | |
parent | tidy up database creation logic a bit (#317) (diff) | |
download | gotosocial-f8630348b4c14215d87921962a2acbe8d3b6c981.tar.xz |
Enable stricter linting with golangci-lint (#316)
* update golangci-lint
* add golangci config file w/ more linters
* correct issues flagged by stricter linters
* add more generous timeout for golangci-lint
* add some style + formatting guidelines
* move timeout to config file
* go fmt
Diffstat (limited to 'internal/db/bundb/bundb.go')
-rw-r--r-- | internal/db/bundb/bundb.go | 12 |
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{}{ >smodel.StatusToEmoji{}, >smodel.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, } } |