From e119bf8ab98cb1517c51c89d3b361e61ac63f7ba Mon Sep 17 00:00:00 2001 From: Dmitry Nikitin Date: Sun, 28 Jan 2024 13:43:11 +0200 Subject: [PATCH 1/2] BugFix: Fixed version parameter --- Makefile | 2 +- cmd/greenmask/main.go | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/Makefile b/Makefile index b9268fef..b61f2d5a 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ CMD_FILES = $(wildcard *.go) TEST_FILES = $(wildcard *.go) COVERAGE_FILE := coverage.out VERSION ?= $(shell git tag --points-at HEAD) -LDFLAGS ?= -X main.version=$(VERSION) +LDFLAGS ?= -X github.com/greenmaskio/greenmask/cmd/greenmask/cmd.Version=$(VERSION) .PHONY: build diff --git a/cmd/greenmask/main.go b/cmd/greenmask/main.go index 4afb8991..21fb64b2 100644 --- a/cmd/greenmask/main.go +++ b/cmd/greenmask/main.go @@ -20,10 +20,7 @@ import ( "github.com/greenmaskio/greenmask/cmd/greenmask/cmd" ) -var version string - func main() { - cmd.Version = version if err := cmd.Execute(); err != nil { log.Fatal().Err(err).Msg("") } From 704f2dfb7f9eca3b0890dd2df83f23f92f0a9849 Mon Sep 17 00:00:00 2001 From: Dmitry Nikitin Date: Sun, 28 Jan 2024 14:51:22 +0200 Subject: [PATCH 2/2] BugFix: Fixed dbname parameter - now it correctly works with PostgreSQL connection string in URI format postgresql:/// --- internal/db/postgres/pgdump/pgdump.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/internal/db/postgres/pgdump/pgdump.go b/internal/db/postgres/pgdump/pgdump.go index 817dd9eb..d511c3e5 100644 --- a/internal/db/postgres/pgdump/pgdump.go +++ b/internal/db/postgres/pgdump/pgdump.go @@ -104,10 +104,11 @@ type Options struct { } func (o *Options) GetPgDSN() (string, error) { - //return "host=localhost port=5432 user=postgres dbname=postgres", nil - if strings.Contains(o.DbName, "=") { + // URI or Standard format + if strings.HasPrefix(o.DbName, "postgresql://") || strings.Contains(o.DbName, "=") { return o.DbName, nil } + return fmt.Sprintf("host=%s port=%d user=%s dbname=%s", o.Host, o.Port, o.UserName, o.DbName), nil }