diff options
author | 2021-06-26 20:59:38 +0200 | |
---|---|---|
committer | 2021-06-26 20:59:38 +0200 | |
commit | b71bbc86a7fbb83f0db49154b13a8e776fd02483 (patch) | |
tree | cb8ebdeceefcd347fbe82a3844ed2fba9ed19db3 | |
parent | separate public key handler (#64) (diff) | |
download | gotosocial-b71bbc86a7fbb83f0db49154b13a8e776fd02483.tar.xz |
remove regex hostname parsing (#67)
Drop regex validation for postgres hostname, because it was breaking when running in a docker-compose stack where hostnames can be just one word.
If necessary this can be added in again later, but it probably won't be necessary because it doesn't actually add anything useful!
-rw-r--r-- | internal/db/pg/pg.go | 8 |
1 files changed, 0 insertions, 8 deletions
diff --git a/internal/db/pg/pg.go b/internal/db/pg/pg.go index 9daf94e31..2758d3c3d 100644 --- a/internal/db/pg/pg.go +++ b/internal/db/pg/pg.go @@ -26,7 +26,6 @@ import ( "fmt" "net" "net/mail" - "regexp" "strings" "time" @@ -48,7 +47,6 @@ type postgresService struct { conn *pg.DB log *logrus.Logger cancel context.CancelFunc - // federationDB pub.Database } // NewPostgresService returns a postgresService derived from the provided config, which implements the go-fed DB interface. @@ -120,12 +118,6 @@ func derivePGOptions(c *config.Config) (*pg.Options, error) { return nil, errors.New("no address set") } - ipv4Regex := regexp.MustCompile(`^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$`) - hostnameRegex := regexp.MustCompile(`^(?:[a-z0-9]+(?:-[a-z0-9]+)*\.)+[a-z]{2,}$`) - if !hostnameRegex.MatchString(c.DBConfig.Address) && !ipv4Regex.MatchString(c.DBConfig.Address) && c.DBConfig.Address != "localhost" { - return nil, fmt.Errorf("address %s was neither an ipv4 address nor a valid hostname", c.DBConfig.Address) - } - // validate username if c.DBConfig.User == "" { return nil, errors.New("no user set") |