Skip to content

Commit

Permalink
Rework config parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
tknie committed Jan 25, 2025
1 parent b096071 commit 69c0c31
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
12 changes: 9 additions & 3 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -477,15 +477,21 @@ func (db *Database) Handles() (*common.Reference, error) {
atomic.AddUint64(&regEntry.readCount, 1)
return regEntry.Reference, nil
}
log.Log.Debugf("Add database hash %s", dHash)
log.Log.Debugf("Database hash not found, creating new for dbhash %s", dHash)
target := os.ExpandEnv(db.Target)
log.Log.Debugf("Handles %s", target)
ref, _, err := common.NewReference(target)
ref, pwd, err := common.NewReference(target)
if err != nil {
return nil, errorrepo.NewError("REST00500", db.Target, err, target)
}
log.Log.Debugf("Register database handler for target %s", db.Target)
_, err = flynn.Handler(ref, os.ExpandEnv(db.Password))
if db.Password != "" {
p := os.ExpandEnv(db.Password)
if p != "" {
pwd = p
}
}
_, err = flynn.Handler(ref, pwd)
if err != nil {
services.ServerMessage("Error registering database <%s>: %v", db.Target, err)
return nil, errorrepo.NewError("REST00501")
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ require (
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
golang.org/x/image v0.23.0 // indirect
golang.org/x/oauth2 v0.25.0 // indirect
google.golang.org/protobuf v1.36.3 // indirect
google.golang.org/protobuf v1.36.4 // indirect
)

require (
Expand All @@ -67,7 +67,7 @@ require (
github.com/rwcarlsen/goexif v0.0.0-20190401172101-9e8deecbddbd
github.com/segmentio/asm v1.2.0 // indirect
github.com/tknie/errorrepo v0.1.0
github.com/tknie/flynn v0.7.0
github.com/tknie/flynn v0.8.0
github.com/tknie/pam v0.0.0-20241226202719-7fe89c1216fb // indirect
go.uber.org/zap v1.27.0
golang.org/x/crypto v0.32.0 // indirect
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ github.com/tknie/adabas-go-api v1.7.11 h1:Ad1WNkPRdjDWAzdD+xcNQp9VxWlwwIWx9K4PvK
github.com/tknie/adabas-go-api v1.7.11/go.mod h1:rqUjLj7nYLkAA1PjUlA2TZ9NlJPCK2CBvHgMrjyRU2A=
github.com/tknie/errorrepo v0.1.0 h1:pOt79EWL4P4UjPzXknNcdAr01fjgF38XY1u1ZzHttqo=
github.com/tknie/errorrepo v0.1.0/go.mod h1:K4bEhPce5B7ybIptX2D2mpRfjWehStjeUG1fiegwoq0=
github.com/tknie/flynn v0.7.0 h1:OJ5XBl7V5jJlbSjs9qcY3jUuHLl6JyxrBk2I+QXqFvg=
github.com/tknie/flynn v0.7.0/go.mod h1:tIxqR6t5TI6EzAWTcyn93hx6+trJR6yiD+Ysely8380=
github.com/tknie/flynn v0.8.0 h1:2RMyuv894RqmFO2rhh5eFiqrYuG30weW5IZyevhRj5E=
github.com/tknie/flynn v0.8.0/go.mod h1:xNqavr6INgCKTW8bpr2HZbryy/wEkk6VwFuVLwfHm3I=
github.com/tknie/goheif v0.0.0-20241029104240-29478ba33138 h1:PUFKDGFiEfT/e6f5XGQ2IGY9lcjEAGdl45z1yl8xY4Y=
github.com/tknie/goheif v0.0.0-20241029104240-29478ba33138/go.mod h1:dVvJAEmU8sloNLQh1wq2+GPwxa/9gg3VXuK/FO8eGX4=
github.com/tknie/log v0.1.0 h1:MrYiDgntQvXm1H0kjJZnz+AI7dB9KbhVYpcohRnAfvU=
Expand Down Expand Up @@ -239,8 +239,8 @@ golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58=
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/protobuf v1.36.3 h1:82DV7MYdb8anAVi3qge1wSnMDrnKK7ebr+I0hHRN1BU=
google.golang.org/protobuf v1.36.3/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
google.golang.org/protobuf v1.36.4 h1:6A3ZDJHn/eNqc1i+IdefRzy/9PokBTPvcqMySR7NNIM=
google.golang.org/protobuf v1.36.4/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
Expand Down
1 change: 1 addition & 0 deletions server/mapping.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ func loadTableOfDatabases() {
//res := m.ReplaceAllString(u, ":****@")
id, err := (&dm).Handles()
if err != nil {
log.Log.Debugf("Handle creation problem: %v", err)
continue
}

Expand Down

0 comments on commit 69c0c31

Please sign in to comment.