Skip to content

Commit

Permalink
fix: replace domain validator add silent logger to gorm
Browse files Browse the repository at this point in the history
  • Loading branch information
doncicuto committed Aug 21, 2022
1 parent 4d2ff4a commit b27085f
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ go 1.13

require (
github.com/Songmu/prompter v0.5.1
github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d
github.com/badoux/checkmail v1.2.1
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/dchest/validator v0.0.0-20191217151620-8e45250f2371
github.com/dgraph-io/badger v1.6.2
github.com/dgraph-io/ristretto v0.1.0 // indirect
github.com/go-asn1-ber/asn1-ber v1.5.4
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,6 @@ github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmV
github.com/armon/go-metrics v0.3.10/go.mod h1:4O98XIr/9W0sxpJ8UaYkvjk10Iff7SnFrb4QAOwNTFc=
github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d h1:Byv0BzEl3/e6D5CLfI0j/7hiIEtvGVFPCZ7Ei2oq8iQ=
github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw=
github.com/badoux/checkmail v1.2.1 h1:TzwYx5pnsV6anJweMx2auXdekBwGr/yt1GgalIx9nBQ=
github.com/badoux/checkmail v1.2.1/go.mod h1:XroCOBU5zzZJcLvgwU15I+2xXyCdTWXyR9MGfRhBYy0=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
Expand Down Expand Up @@ -122,6 +120,8 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dchest/validator v0.0.0-20191217151620-8e45250f2371 h1:BuLreR1acrosGsW+njS+RxyPgL06rYTkasZA2NAogEo=
github.com/dchest/validator v0.0.0-20191217151620-8e45250f2371/go.mod h1:ZfpgrLR1i3mQWz5fIRfkyMIh9zLOy3MwTc7hUBVPlww=
github.com/denisenkom/go-mssqldb v0.0.0-20191124224453-732737034ffd h1:83Wprp6ROGeiHFAP8WJdI2RoxALQYgdllERc3N5N2DM=
github.com/denisenkom/go-mssqldb v0.0.0-20191124224453-732737034ffd/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU=
github.com/dgraph-io/badger v1.6.2 h1:mNw0qs90GVgGGWylh0umH5iag1j6n/PeJtNvL6KY/x8=
Expand Down
2 changes: 1 addition & 1 deletion server/db/initialize.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ func Initialize(dbName string, sqlLog bool, dbInit types.DBInit) (*gorm.DB, erro
if sqlLog {
db, err = gorm.Open(sqlite.Open(dbName), &gorm.Config{Logger: logger.Default.LogMode(logger.Info)})
} else {
db, err = gorm.Open(sqlite.Open(dbName), &gorm.Config{})
db, err = gorm.Open(sqlite.Open(dbName), &gorm.Config{Logger: logger.Default.LogMode(logger.Silent)})
}

if err != nil {
Expand Down
6 changes: 3 additions & 3 deletions server/ldap/domain.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ import (
"strings"
"time"

"github.com/asaskevich/govalidator"
"github.com/dchest/validator"
)

func GetDomain(domain string) string {
const defaultDomain string = "dc=example,dc=org"

if !govalidator.IsDNSName(domain) {
fmt.Printf("%s [Glim] ⇨ LDAP_DOMAIN env does not contain a valid domain, using example.org...\n", time.Now().Format(time.RFC3339))
if !validator.IsValidDomain(domain) {
fmt.Printf("%s [Glim] ⇨ ldap domain does not contain a valid domain, using example.org...\n", time.Now().Format(time.RFC3339))
return defaultDomain
}

Expand Down

0 comments on commit b27085f

Please sign in to comment.